Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Updated 10-Aug-18 0:09am

1 solution

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);
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900