htmlunit

How to overcome an HTMLUnit ScriptException?

瘦欲@ 提交于 2019-11-26 05:36:22
问题 I got a problem with a line of code that probably triggers some js function e couse an exception, how can i fix this? box.setText(link.toString()); client.waitForBackgroundJavaScriptStartingBefore(10000); box.dblClick(); //this line cause the exception Exception in thread \"main\" ======= EXCEPTION START ======== EcmaError: lineNumber=[0] column=[0] lineSource=[function () {] name=[ReferenceError] sourceName=[onclick event for HtmlDivision[<div class=\"_119 stat_elem focus_target mtm mbl

Turning HtmlUnit Warnings off

为君一笑 提交于 2019-11-26 03:53:10
问题 Do you know how can I turn Warnings, Notes, Errors in HtmlUnit off? 回答1: Put this somewhere around the start of your code; it will shut its dirty mouth: LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF); java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF); webClient = new WebClient(bv); webClient

Get the changed HTML content after it&#39;s updated by Javascript? (htmlunit)

六月ゝ 毕业季﹏ 提交于 2019-11-26 03:42:13
问题 I\'m having some trouble figuring out how to get the content of some HTML after javascript has updated it. Specifically, I\'m trying to get the current time from US Naval Observatory Master Clock. It has an h1 element with the ID of USNOclk in which it displays the current time. When the page first loads, this element is set to display \"Loading...\", and then javascript kicks in and updates it to the current time via function showTime() { document.getElementById(\'USNOclk\').innerHTML=\