未捕获的SyntaxError:在测试打开加密的epub时,无法在'Element'上设置'innerHTML'属性

问题描述 投票:2回答:1

在尝试使用TestCafe打开加密的epub时,我始终遇到此错误:Uncaught SyntaxError: Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.

In browser mode, the script shows the browser throwing this error: error in line 10 at column 8: Opening and ending tag mismatch: meta line 0 and head

我发现了这个可能的原因:

XHTML does not support document.write or .innerHTML. Due to the fact, that jQuery inserts the new code using one of these methods, all XHTML compatible browsers will error out

这是否意味着我根本不能使用TestCafe来进行这种操作?

我使用的代码是一个简单的.click(bookselector)

automated-tests e2e-testing epub web-testing testcafe
1个回答
2
投票

TestCafe只能测试HTML页面。当您点击链接时,您的浏览器可以将EPUB文件视为页面,因为EPUB格式与XML和HTML非常相似。考虑通过href检索URL并使用http.requestgot下载文件,而不是单击指向EPUB文件的链接。

© www.soinside.com 2019 - 2024. All rights reserved.