I want to render this page CLICK and get html as string. So I use this code:
public class ChromeRender implements RenderService {
private final static Logger LOGGER = Logger.getLogger(ChromeRender.class.getName());
private final WebDriver driver;
public ChromeRender() {
ChromeOptions options = new ChromeOptions();
options.addArguments( "--headless --window-size=1920,1200","--ignore-certificate-errors");
options.addArguments("--user-agent=New User Agent");
options.addArguments("--disable-features=top-document-isolation,site-per-process");
this.driver = new ChromeDriver(options);
}
@Override
public String renderPage(String url) {
var start = System.currentTimeMillis();
driver.get(url);
LOGGER.info("Page downloaded in "+ (System.currentTimeMillis()-start) + " ms");
System.out.println(driver.getPageSource());
return driver.getPageSource();
}
}
The problem is that, invoked method getPageSource() returns html but without iframe content rendered. In browser, content is rendering just fine - there is nice html tree with content I want. But result from method .getPageSource() returns html without iframe properly rendered. Whats the problem here? Is this method supposed to return html as string that is equal to what I see in browser?