I have successfully saved the source code of a webpage but some webpages dynamically serve the info. That makes it so I cannot get the info that’s on the page.. If I right click and "inspect element" it’s there.. Is there any way to copy what is loaded from that webpage and save it to a text file?
Asked
Active
Viewed 2,490 times
2
-
1Maybe you want JSoup? – chrylis -cautiouslyoptimistic- Jun 27 '15 at 02:08
2 Answers
0
use selenium webdriver to get page source and even you can get the values of a particular element say inputbox, checkbox,dropdown etc from the webpage. Also you can enter the values and submit the form
reate a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
System.out.println( driver.getPageSource());
driver.quit();
}
}
refer getPageSource() in Selenium WebDriver(a.k.a Selenium2) using Java
0
if you're looking for the web page source use this
Create a driver instance
WebDriver driver=new WebDriver();
call the below function when you think the dynamically served content is appeared on the web page
driver.getPageSource();
this should work.

Chaitanya Pujari
- 367
- 4
- 16