afterbit
afterbit

Reputation: 407

HTmlUnit doesn't grab entire page

HtmlUnit version 2.14 I'm trying to grab this page. This is my code :

public class Main {

  static final WebClient browser;

  static {

    browser = new WebClient(BrowserVersion.FIREFOX_24);
    browser.getOptions().setJavaScriptEnabled(true);

    CookieManager cookieMan = new CookieManager();
    cookieMan = browser.getCookieManager();
    cookieMan.setCookiesEnabled(true);

    browser.getOptions().setRedirectEnabled(true);
    browser.getOptions().setThrowExceptionOnFailingStatusCode(false);

    browser.getOptions().setPrintContentOnFailingStatusCode(true);
    browser.getOptions().setThrowExceptionOnScriptError(false);


  }

  public static void main(String[] arguments) {


    doTestHANJINMobile();

  }

  private static void doTestHANJINMobile() {

    try {


      HtmlPage page = (HtmlPage) browser.getPage("http://m.hanjin.com/mhanjin/CUP_MOB_0802.do?menuFlag=C&searchType=C&blCntrNo=CAXU3336862");

      System.out.println("waitForBackgroundJavaScript...");
      browser.waitForBackgroundJavaScriptStartingBefore(5000);
      browser.waitForBackgroundJavaScript(5000);

      System.out.println("XML Source : \n" + page.asXml() + "\n");

    } catch (Exception e) {
      System.out.println("EXCEPTION --------------- " + e.toString());
    }

  }
}

But i get just the "Sailing Information" table and not the "Container Detail" table. I tried with other browser version ( IE, Chrome..) but nothing happens...

Upvotes: 0

Views: 92

Answers (1)

afterbit
afterbit

Reputation: 407

It works with HtmlUnit version 2.15!

Upvotes: 1

Related Questions