Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HtmlUnit to view source

Tags:

java

htmlunit

HtmlUnit for Java is great but I haven't been able to figure out how to view the full source or return the source of a web site as a string. can anyone help me with this?

I know the follow will read the site but now I just want to return the source to a string.

HtmlPage mySite = webClient.getPage("http://mysite.com");

Thanks!

like image 607
Jake Sankey Avatar asked May 13 '11 19:05

Jake Sankey


1 Answers

From looking through the API, my thought would be:

mySite.getWebResponse().getContentAsString();
like image 76
Jeremy Avatar answered Sep 22 '22 20:09

Jeremy