I am not allowed to use FileUtils in the program and error is shown when doing so. Even no suggestion is showing to import this pre-defined Class. I tried to search the solu
Yes with Selenium Latest version we should use FileHandler.copy() It works and doesn't throw any error.
// Take Screenshots example
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileHandler.copy(scrFile, new File("<your path>\\screenshot.png"));
The line FileUtils.copyFile();
has been updated to FileHandler.copy()
FileUtils Class is defined in org.apache.commons.io.FileUtils which provides the general file manipulation utilities in the following areas :
org.apache.commons.io is bundled along with selenium-server-standalone-x.y.z by default and available ready to use.
But the behavior you are observing is pretty much inline with your usecase where you mentioned that you are not allowed to use FileUtils in the program. It can be either of the scenarios as mentioned below :
For the following above mentioned reasons, when you mention FileUtils in your program it doesn't show any suggestion to import the class. Moreover if you forcefully provide the import, it will show error on that line.