Click here to Skip to main content
13,793,043 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have already the following code which is taking the screenshot of the visible page.
My goal is taking a full page screenshot instead .
Cal someone help me with this ?

What I have tried:

// please find below the Current code

public void TakeScreenshot(String path, String imgName)
{

Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot();

//String dir = path;
String filepath = path;

if (!Directory.Exists(filepath))
Directory.CreateDirectory(filepath);

ss.SaveAsFile(filepath + imgName + ".png", ScreenshotImageFormat.Png);

}
Posted 10-Aug-18 0:51am
Updated 10-Aug-18 1:09am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try this,

public void TakeScreenshot(String url, String image)
{
	var driver = new InternetExplorerDriver();
	driver.Navigate().GoToUrl(url); 
	var ss = driver.GetScreenshot();
	ss.SaveAsFile(image, System.Drawing.Imaging.ImageFormat.Png);
}
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.181207.3 | Last Updated 10 Aug 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100