org.openqa.selenium
Interface TakesScreenshot


public interface TakesScreenshot

Indicates a driver that can capture a screenshot and store it in different ways.

Example usage:

 import static openqa.selenium.OutputType.*;
 
 File screenshotFile = ((Screenshot)driver).getScreenshotAs(file);
 String screenshotBase64 = ((Screenshot)driver).getScreenshotAs(base64);
 

See Also:
OutputType

Method Summary
<X> X
getScreenshotAs(OutputType<X> target)
          Capture the screenshot and store it in the specified location.
 

Method Detail

getScreenshotAs

<X> X getScreenshotAs(OutputType<X> target)
                  throws WebDriverException
Capture the screenshot and store it in the specified location.

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 visisble portion of the HTML element

Type Parameters:
X - Return type for getScreenshotAs.
Parameters:
target - target type, @see OutputType
Returns:
Object in which is stored information about the screenshot.
Throws:
WebDriverException - on failure.


Copyright © 2012. All Rights Reserved.