I’m working on a code using Selenium Webdriver Java and TestNG. How can I take a screenshot using Boolean
public boolean test()throws Exception {}
Below are the steps I used but it is showing error:
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));
The error is showing in this line for the copyFile as
The method copyFile(File, File) is
undefined for the type FileUtils
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));