0

I am searching for a way to get the POST html code of a webpage that is rendered. In Firefox there is an AddOn called Web Developper which can return not only the "normal" sourcecode but also the rendered sourcecode.

Example: https://bs.chregister.ch/cr-portal/auszug/auszug.xhtml?uid=CHE-230.467.384#

I need to get an HTML sourcecode of this website that includes content like the adress (in this case "c/o Nora Stähelin" and "Kraftstr. 1"). My code looks like this:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Automation {    
    public static void main(String[] args) {
        String exePath = "src\\seleniumAutomation\\resources\\chromedriver.exe";
        System.setProperty("webdriver.chrome.driver", exePath);

        WebDriver driver = new ChromeDriver();
        String URL = "https://bs.chregister.ch/cr-portal/auszug/auszug.xhtml?uid=CHE-230.467.384#";
        driver.get(URL);

        // get PRE SourceCode
        String pageSource = driver.getPageSource();
        System.out.println(pageSource);

        // get POST SourceCode (containing content)
        // TODO 

        // close window
        driver.quit();      
    }
}

edit: generated HTML refers to the HTML after JavaScript changes the DOM.

thomas
  • 429
  • 4
  • 17
  • I think this is a duplicate of https://stackoverflow.com/questions/6509628/how-to-get-http-response-code-using-selenium-webdriver-with-java – Grzegorz Sancewicz Aug 14 '17 at 20:16
  • @GrzegorzSancewicz no i dont want the HTTP response code, i want the generated html code after all rendering is done. I dont know if i described it properly, but i need the code AFTER rendering the page. Something like the firefox addon "Web Developer" can do (there you have the option "view genereted html code"). – thomas Aug 14 '17 at 21:19

0 Answers0