selenium Take a screenshot of a webpage C# TakeScreenshot extension


Example

public static Screenshot TakeScreenshot(this IWebDriver _driver)
{
    return ((ITakesScreenshot)_driver).GetScreenshot();
}

Usage example:

driver.TakeScreenshot().SaveAsFile(@"/Test/Test.png",ImageFormat.Png);