public interface TakesScreenshot
Example usage:
File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); String screenshotBase64 = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);
OutputType
Modifier and Type | Method and Description |
---|---|
<X> X |
getScreenshotAs(OutputType<X> target)
Capture the screenshot and store it in the specified location.
|
<X> X getScreenshotAs(OutputType<X> target) throws WebDriverException
For WebDriver extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference:
For WebElement extending TakesScreenshot, this makes a best effort depending on the browser to return the following in order of preference: - The entire content of the HTML element - The visible portion of the HTML element
X
- Return type for getScreenshotAs.target
- target type, @see OutputTypeWebDriverException
- on failure.