Reputation: 62
I am testing my web application using selenium, I am able to take screenshot but it only captures the area visible on screen (doesn’t scroll the page)
My requirement is to get the screenshot of entire page.
I am using code to capture screenshot is:
var ss = driver.GetScreenshot();
ss.SaveAsFile("ss.png",System.Drawing.Imaging.ImageFormat.Png);
Upvotes: 1
Views: 856
Reputation: 62
I found an answer for which might help others. Below is the function which will take a full page screenshot and save it to the desired location.
public void TakeFullScreenshot(IWebDriver driver, String filename)
{
Screenshot screenshot = ((ITakesScreenshot)driver).GetScreenshot();
screenshot.SaveAsFile(filename, ImageFormat.Png);
}
Upvotes: 0
Reputation: 5204
There is a package called Noksa.WebDriver.ScreenshotsExtensions try it!
You can use VerticalCombineDecorator
like this:
var verticalscreenshot = new VerticalCombineDecorator(new ScreenshotMaker());
var screen = driver.TakeScreenshot(verticalscreenshot);
You can look up this answer...
Hope this helps you!
Upvotes: 0