Home » Selenium C# Scripts » Take screenshot of the webpage using Selenium C#

Take screenshot of the webpage using Selenium C#

Following script is used to take screenshot of the webpage and save in your local drive. (using C#)

ITakesScreenshot screen = driver as ITakesScreenshot;  // ITakesScreenshot is  an interface inside OpenQA.Selenium namespace
Screenshot scrnst = screen.GetScreenshot();  // Screenshot is a class inside OpenQA.Selenium namespace
string screenshot = "c:\\screens\\myScreenShot1.png";
scrnst.SaveAsFile(screenshot, ImageFormat.Png);

 


11 Comments

  1. Well done pavan, keep going ,the topics which u have covered all very useful. Expecting few more in near future.

    All the best man.

Leave a comment

Your email address will not be published. Required fields are marked *