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