Note that there are some explanatory texts on larger screens.

plurals
  1. POHTMLUnit : super slow execution?
    primarykey
    data
    text
    <p>I have been using HTMLUnit . It suits my requirements well. But it seems to be extremely slow. for example : I have automated the following scenario using HTMLUnit</p> <pre><code>Goto Google page Enter some text Click on the search button Get the title of the results page Click on the first result. </code></pre> <p>Code :</p> <pre><code>long t1=System.currentTimeMillis(); Logger logger=Logger.getLogger(""); logger.setLevel(Level.OFF); WebClient webClient=createWebClient(); WebRequest webReq=new WebRequest(new URL("http://google.lk")); HtmlPage googleMainPage=webClient.getPage(webReq); HtmlTextInput searchTextField=(HtmlTextInput) googleMainPage.getByXPath("//input[@name='q']").get(0); HtmlButton searchButton=(HtmlButton) googleMainPage.getByXPath("//button[@name='btnK']").get(0); searchTextField.type("Sri Lanka"); System.out.println("Text typed!"); HtmlPage googleResultsPage= searchButton.click(); System.out.println("Search button clicked!"); System.out.println("Title : " + googleResultsPage.getTitleText()); HtmlAnchor firstResultLink=(HtmlAnchor) googleResultsPage.getByXPath("//a[@class='l']").get(0); HtmlPage firstResultPage=firstResultLink.click(); System.out.println("First result clicked!"); System.out.println("Title : " + firstResultPage.getTitleText()); //System.out.println(firstResultPage.asText()); long t2=System.currentTimeMillis(); long diff=t2-t1; System.out.println("Time elapsed : " + milliSecondsToHrsMinutesAndSeconds(diff)); webClient.closeAllWindows(); </code></pre> <p>It works 100% well. But it takes 3 minutes,41 seconds</p> <p>I guess the reason for the slow execution is validating each and every element on the page. </p> <p>My question is how to reduce the execution time of HTMLUnit ? is there any way to disable validations on webpages.</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload