Is it possible to get the codes of “elements” which is shown to me when I press F12 by using JAVA?
I recently need to get a specific information from the element code from thousands of webpage with the same coding format.
Is it possible to get the codes of “elements” which is shown to me when I press F12 by using JAVA?
I recently need to get a specific information from the element code from thousands of webpage with the same coding format.
You can do it using Selenium:
WebClient webClient = new WebClient();
webClient.getOptions().setCssEnabled(false);
webClient.setCssErrorHandler(new SilentCssErrorHandler());
String url = "https://www.google.com";
HtmlPage page = webClient.getPage(url);
System.out.println(page.asXml());
webClient.close();
Include Dependency:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.40.0</version>
</dependency>
Include any other dependency if required.