Indicates a driver or an HTML element that can capture a screenshot and store it in different ways. Example usage: File screenshotFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); String screenshotBase64 = ((TakesScreenshot) element).getScreenshotAs(OutputType.BASE64); <
| 30 | * @see OutputType |
| 31 | */ |
| 32 | public interface TakesScreenshot { |
| 33 | /** |
| 34 | * Capture the screenshot and store it in the specified location. |
| 35 | * |
| 36 | * <p>For a W3C-conformant WebDriver or WebElement, this behaves as stated in <a |
| 37 | * href="https://w3c.github.io/webdriver/#screen-capture">W3C WebDriver specification</a>. |
| 38 | * |
| 39 | * <p>For a non-W3C-conformant WebDriver, this makes a best effort depending on the browser to |
| 40 | * return the following in order of preference: |
| 41 | * |
| 42 | * <ul> |
| 43 | * <li>Entire page |
| 44 | * <li>Current window |
| 45 | * <li>Visible portion of the current frame |
| 46 | * <li>The screenshot of the entire display containing the browser |
| 47 | * </ul> |
| 48 | * |
| 49 | * For a non-W3C-conformant WebElement extending TakesScreenshot, this makes a best effort |
| 50 | * depending on the browser to return the following in order of preference: |
| 51 | * |
| 52 | * <ul> |
| 53 | * <li>The entire content of the HTML element |
| 54 | * <li>The visible portion of the HTML element |
| 55 | * </ul> |
| 56 | * |
| 57 | * @param <X> Return type for getScreenshotAs. |
| 58 | * @param target target type, @see OutputType |
| 59 | * @return Object in which is stored information about the screenshot. |
| 60 | * @throws WebDriverException on failure. |
| 61 | * @throws UnsupportedOperationException if the underlying implementation does not support |
| 62 | * screenshot capturing. |
| 63 | */ |
| 64 | <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException; |
| 65 | } |
no outgoing calls
no test coverage detected