chrome-devtools-java-client
chrome-devtools-java-client copied to clipboard
How to avoid hang on extracting HTML content from non HTML page (solved)
I was having a problem with this command when browsing to content that happened to be XML - the evaluation function hung indefinitely.
devToolsService.getRuntime().evaluate("document.documentElement.outerHTML")
Here is a work around:
Object contentType = devToolsService.getRuntime().evaluate("document.contentType");
if((contentType != null) && "text/html".equalsIgnoreCase(contentType.toString())) {
devToolsService.getRuntime().evaluate("document.documentElement.outerHTML")
}