Search code examples
c#selenium-rcscreenshot

How to take screenshot using Selenium RC using c# in IE8?


I am using Selenium RC using c# and need to take screenshot for the test case failed, I have to perform these test on IE 8.

I got lot of tutorials for Firefox but didn't find any for the IE8.

Thanks in advance.


Solution

  • You can use the Selenium Web Driver to take a screenshot of IE pretty easily. The code would look something like this:

    IWebDriver driver = new InternetExplorerDriver();
    driver.Navigate().GoToUrl("http://www.google.com");
    TakeScreenshot(driver, @"C:\screenshot.png");
    

    You can download the Web Driver here: https://code.google.com/p/selenium/downloads/list Add it to your project and you are off and running.