1

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);
Akash Jha
  • 62
  • 5

2 Answers2

0

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!

Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
0

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);
}
Akash Jha
  • 62
  • 5