Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving Screenshot file

My code for saving screenshot file is:

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\screenshots\\"+Filename+".jpg"));

The Error is :

The method copyFile (File, File)is undefined for the type FileUtil

I use an EventFiringWebDriver . Any ideas on this.

like image 336
Ram Avatar asked Oct 21 '25 11:10

Ram


1 Answers

There are two possible explanations.

  1. The error message you provided mentions FileUtil class instead of FileUtils You may have used wrong class by mistake.
  2. Assuming you are using the correct FileUtils class you may have imported wrong package. Make sure that you have imported org.apache.commons.io.FileUtils
like image 139
JacekM Avatar answered Oct 25 '25 15:10

JacekM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!