From: Ahmed A. <asa...@ya...> - 2016-07-13 12:38:47
|
Hi, Thanks for the minimal test case, fixed in SVN. You can get latest build from [1]. Ahmed[1] https://ci.canoo.com/teamcity/viewLog.html?buildTypeId=HtmlUnit_FastBuild&buildId=lastSuccessful&tab=artifacts From: 蒲云 <cl...@12...> To: htmlunit-user <htm...@li...> Sent: Sunday, July 10, 2016 6:09 AM Subject: [Htmlunit-user] A test case about js native function getComputedStyle The following html shows "ok!" in browsers, but exceptions caught by htmlunit。 html code: <html><head><title>test</title></head> <body> <div id="target">origin</div> <script type="text/javascript"> try{ getComputedStyle(void 0); }catch(e){}; document.getElementById("target").textContent="ok!"; </script> </body> </html> Java code: public static void main(String[] args) throws Exception { String link = "file:test_002.html"; try (WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED)) { webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); HtmlPage page = webClient.getPage(link); webClient.waitForBackgroundJavaScriptStartingBefore(800); webClient.waitForBackgroundJavaScript(800); System.out.println(page.getElementById("target").getTextContent()); // should be ok! } } | | | | | | | | | | | Log in to TeamCity — TeamCity Powerful Continuous Integration and Build Server | | | | |