Akash Jha
Akash Jha

Reputation: 62

How to get full page screenshot of my web application?

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

Answers (2)

Akash Jha
Akash Jha

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

Moshe Slavin
Moshe Slavin

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

Related Questions