user3686522
user3686522

Reputation: 17

Error when taking a screenshot in Selenium WebDriver

I'm trying to take a screenshot by using the following code:

WebDriver driver = new FirefoxDriver();
driver.get("https://10.4.16.159/");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\test\\screenshot.JPG"));

But I'm not able to take the screenshot.

Upvotes: 1

Views: 1156

Answers (1)

KOleg
KOleg

Reputation: 59

Try to save screenshot to another disk partition, etc d:

FileUtils.copyFile(scrFile, new File("d:\\screenshot.JPG"));

. It seems like app just does not have permission to drive c:

Upvotes: 1

Related Questions