3

I am trying to capture a screenshot of a webpage using the mentioned below script:

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

FileUtils.copyFile(scrFile, new File("D:\\screenshot.jpg"));

I am getting an error as "The method copyFile(File, File) is undefined for the type FileUtils". I have imported package import java.io.IOException; and import com.sun.jna.platform.FileUtils;

Please help me on this!

olyv
  • 3,699
  • 5
  • 37
  • 67
Ak17
  • 75
  • 3
  • 15

1 Answers1

1

Apache Commons IO is the library you probably want to use. Import FileUtils from org.apache.commons.io (java docs, home page).

Artur Malinowski
  • 1,124
  • 10
  • 30
  • The issue has resolved on adding the org.apache.commons.io (java docs, home page) package. – Ak17 May 27 '14 at 14:14