code snippet
webClient = new WebClient(BrowserVersion.CHROME); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setAppletEnabled(true); webClient.setPrintHandler(new MyPrintHandler()); webClient.waitForBackgroundJavaScript(5000); webClient.waitForBackgroundJavaScriptStartingBefore(5000); // this line throw exception page1.executeJavaScript("html2canvas(document.body).then(function(canvas) {\n" + "\n" + "console.log(2222)\n" + "\n" + "});");
[WARN ] 2023-06-05 17:28:56,893 method:org.htmlunit.javascript.host.html.HTMLDocument.close(HTMLDocument.java:518) close() called when document is not open.