2

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?

2 Answers2

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

https://code.google.com/p/selenium/wiki/GettingStarted

Community
  • 1
  • 1
KDP
  • 1,481
  • 7
  • 13
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