Search code examples
screenshotwebdriverselenium-webdriverwebpage-screenshot

Selenium2: Taking screenshots with selenium grid 2


Is it possible to take screenshots using selenium grid 2? The RemoteWebDriver class does not implement the TakesScreenshot interface.

Mark


Solution

  • The RemoteWebDriver must be augmented before you can use the screenshot capability. As you have no doubt already found, attempting to cast without augmenting results in an exception.

    WebDriver driver = new RemoteWebDriver( ... );
    driver           = new Augmenter().augment( driver );
    ( (TakesScreenshot)driver ).getScreenshotAs( ... );