question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HtmlUnit setJavaScriptTimeout returns immediately

See original GitHub issue

Eg URL: https://www.tdsinc.com/investor-relations/financials/quarterly-results/default.aspx

Using 2.44 HtmlUnit version, I have tried getting the entire page with webClient.getPage(url), the page was returned immediately though the following options are set: webClient.waitForBackgroundJavaScript(100000); webClient.setJavaScriptTimeout(20000);

While, I added an explicit Thread.sleep(3000) //3s after calling webclient.getPage(url) returned me the entire page. Is this expected or is there something I am missing out.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Oct 20, 2020
webClient.waitForBackgroundJavaScript(100000);

is not an option. You have to call this after getPage().

This code works here

    String url = " https://www.tdsinc.com/investor-relations/financials/quarterly-results/default.aspx";

    WebClient webClient = new WebClient(BrowserVersion.FIREFOX);

    HtmlPage page = webClient.getPage(url);
    webClient.waitForBackgroundJavaScript(20_000);

    System.out.println("#### ---- ");
    System.out.println(page.asText());
    System.out.println("#### ---- ");
0reactions
sowjanyaboddeticommented, Oct 21, 2020

It is working now. Thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

logging - HtmlUnit Timeout Debugging - Stack Overflow
Extremely simple code not working in HtmlUnit ... The HtmlUnit uses driver.setJavaScriptTimeout(1000) to set JavaScript time out.
Read more >
WebClient (HtmlUnit 2.67.0 API)
Returns the cookie manager used by this web client. Set<Cookie>, getCookies(URL url). Returns the currently configured cookies applicable to the specified URL ...
Read more >
WebClient.setJavaScriptTimeout - Tabnine
Creates an instance that will use the specified BrowserVersion and proxy server. getOptions. Returns the options object of this WebClient. getCookieManager.
Read more >
JBoss.org Content Archive (Read Only)
I keep getting JavascriptTimeoutException for every test that I run with the new HtmlUnit version of JSFUnit.
Read more >
htmlunit/WebClient.java at master - GitHub
HtmlUnit is a "GUI-Less browser for Java programs". ... task scheduled to start executing within the specified time, this method returns immediately --...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found