Skip to content

Instantly share code, notes, and snippets.

@FriendlyTester
Created October 14, 2013 21:01
Show Gist options
  • Save FriendlyTester/6982140 to your computer and use it in GitHub Desktop.
Save FriendlyTester/6982140 to your computer and use it in GitHub Desktop.
RemoteWebDriver Screenshot
public class ScreenShotRemoteWebDriver : RemoteWebDriver, ITakesScreenshot
{
public ScreenShotRemoteWebDriver(Uri remoteAddress, ICapabilities desiredCapabilities)
: base(remoteAddress, desiredCapabilities)
{
}
public Screenshot GetScreenshot()
{
// Get the screenshot as base64.
Response screenshotResponse =
this.Execute(DriverCommand.Screenshot, null);
string base64 = screenshotResponse.Value.ToString();
// ... and convert it.
return new Screenshot(base64);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment