November 2012
Intermediate to advanced
326 pages
6h 41m
English
While running tests with RemoteWebDriver or Grid it is not possible to take the screenshots, as the TakesScreenshot interface is not implemented in RemoteWebDriver.
However, we can use the Augmenter class which adds the TakesScreenshot interface to the remote driver instance.
In this recipe, we will use the Augmenter class to capture a screenshot from RemoteWebDriver.
Create a test which uses RemoteWebDriver.
Add the following code to the test using RemoteWebDriver:
driver = new Augmenter().augment(driver);
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));The Augmenter ...
Read now
Unlock full access