0

I Use this code for to print the page source.

HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.CHROME);
driver.setJavascriptEnabled(true);

driver.get("https://www.google.co.in/");

String source=driver.getPageSource();
System.out.println(source);

But it is returning me only this :

<?xml version="1.0" encoding="UTF-8"?>
<html>
<head/>
<body/>
</html>

Why is this happenning..? How can i get the full source code..? Please help

Bibin Biju
  • 11
  • 3
  • Possible duplicate of [How to get a web page's source code from Java](http://stackoverflow.com/questions/8616781/how-to-get-a-web-pages-source-code-from-java) – Shreyas Sarvothama Oct 24 '16 at 15:53
  • Have you tried searching this page.. http://stackoverflow.com/questions/11248300/htmlunitdriver-not-getting-page-properly – Shreyas Sarvothama Oct 24 '16 at 15:56

0 Answers0