0

I am getting the proper htmlContent while using this code for other sites but one site this is not working (see below). Please advise what additional I can do?

public class Test3 {
        public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException {
            String url = "https : / / altera . wd1 . myworkdayjobs . com / Altera / jobs";
            String content = HtmlPageFetcher.fetchPage(url, "firefox", 50000);
            System.out.println(content);
    }

    public static String fetchPage(String url, String browser, long delayinmillis) {
        WebClient webClient;
        webClient = new WebClient(BrowserVersion.FIREFOX_17);
        webClient.getOptions().setCssEnabled(false);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
        webClient.getOptions().setUseInsecureSSL(true);
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());

        String content="";
        try {               
            HtmlPage page = webClient.getPage(url);
            webClient.waitForBackgroundJavaScript(delayinmillis);
            content = page.asXml();
            webClient.closeAllWindows();
            webClient = null;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(webClient!=null)
                webClient.closeAllWindows();
        }
        return content;
    }

I tried CHROME AND IE as well. The data is filled on webpage is by JSON (as I see via inspect element in chrome)

Shashank
  • 712
  • 15
  • 33

1 Answers1

0

A small fix was made.

Please get latest snapshot from maven or from the build server.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56