Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to use a library that has javascript support. I use <strong>HtmlUnit</strong> for this which is a great library for replicating browser behavior!</p> <p>See my modified answer <a href="https://stackoverflow.com/questions/14740801/easiest-way-to-browse-to-a-page-and-submit-form-in-java/14905070#14905070" title="from this question">from this question</a> below for a simple example of how to access a page with javascript. </p> <p><strong>First</strong>, check out their web page(<a href="http://htmlunit.sourceforge.net/" rel="nofollow noreferrer">http://htmlunit.sourceforge.net/</a>) to get htmlunit up and running. Make sure you use the latest snapshot(2.12 when writing this)</p> <p>Try these settings to ignore pretty much any obstacle:</p> <pre><code>WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setJavaScriptEnabled(true); webClient.getCookieManager().setCookiesEnabled(true); </code></pre> <p>Then when fetching your page, make sure you wait for background Javascript before doing anything with the page, like waiting for background javascript.</p> <pre><code>//Get Page HtmlPage page1 = webClient.getPage("https://login-url/"); //Wait for background Javascript webClient.waitForBackgroundJavaScript(10000); //Get full page _after_ javascript has rendered it fully System.out.println(page1.asXml()); </code></pre> <p>I hope this basic example will help you!</p> <p>You can use HtmlUnit to do pretty much anything a browser can do, but programmatically.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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