Hi,
By using the TakeScreenshot I am not able to get full page screenshot of chrome and Firefox in Selenium 3.4. It is only bringing the screenshot of the browser which is currently visible on the screen and not the section below it which has to be scrolled down to,
For chrome I am using chrome version 57 and driver 2.28
For Firefox I am using Version 53 with geckodriver-v0.16.0-win64
The code I am using to capture screenshot is : -
private static String takeScreenshot(WebDriver lDriver) throws IOException, HeadlessException, AWTException {
try {
String screenshotBase64 = ((TakesScreenshot)lDriver).getScreenshotAs(OutputType.BASE64);
return screenshotBase64;
}
catch (Exception e) {
throw e;
}
}
Screenshots will only show the current viewport going forward
https://w3c.github.io/webdriver/webdriver-spec.html#take-screenshot
@lmtierney Is there any suggestions on how can I capture the whole page in screenshot ??
I have no suggestions unfortunately. It is very hard to capture the "entire page" since it is hard to define that. What happens if the page is lazy loaded or never-ending? How do you capture that? Would have to do some research
@lmtierney okay thanks for the reply. Pls let me know if you come across anything for a workaround for this.
Firefox supports the command "screenshot --fullpage" from the developer console (Shift+F2).
There is no need to worry about how to define "entire page" or lazy-load, etc, just need to execute this command.
I tried sending Shift+F2 using SendKeys() but that didn't work.. Is there anyway to execute a Firefox developer console command from a Selenium script?
Most helpful comment
Screenshots will only show the current viewport going forward
https://w3c.github.io/webdriver/webdriver-spec.html#take-screenshot