Skip to content Skip to sidebar Skip to footer

Htmlunitdriver Not Getting Page Properly

I'm a newbie at this, basically I'm trying to use the HtmlUnitDriver, this is my code: WebDriver driver = new HtmlUnitDriver(); driver.get('http://www.google.com'); System.out.prin

Solution 1:

HtmlUnitDriver defaults to having javaScript disabled google.com relies heavily on javascript. try using driver.setJavascriptEnabled(true)

WebDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true)
driver.get("http://www.google.com");
System.out.println(driver.getPageSource());

Solution 2:

The issue is definitely due to proxy missing while starting htmlunitdriver. You will have to provide proxy details

Post a Comment for "Htmlunitdriver Not Getting Page Properly"