While attempting to open encrypted epubs using TestCafe I consistently get this error:
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
I found this possible reason:
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
Does this mean that I cannot use TestCafe at all to do this kind of operation?
The code I am using is a simple .click(bookselector)
TestCafe can test HTML pages only. Your browser can treat EPUB files as pages when you click on a link because EPUB format is very similar to XML and HTML. Instead of clicking on a link to an EPUB file, consider retrieving the URL via the href
and use http.request or got to download the file.