Monday, January 4, 2016

WebDriver - Full Page Screenshots

WebDriver - Full Page Screenshots


Below code is taking the screenshot of "www.google.com".
In above code, ITakesScreenshot defines the interface used to take screen shot images of the screen. It has a method named GetScreenshot. GetScreenshot gets a Screenshot object representing the image of the page on the screen. AsBase64EncodedString helps you in getting the value of the screenshot image as a Base64-encoded string. Before saving the file we are storing it as an array of bytes.

Also take a look at Best way to take screenshots of tests in Selenium 2?