FileUtils not showing suggestion to import predefined class for Screenshot functionality in selenium WebDriver

女生的网名这么多〃 提交于 2019-12-02 00:32:20

FileUtils Class

FileUtils Class is defined in org.apache.commons.io.FileUtils which provides the general file manipulation utilities in the following areas :

  • writing to a file
  • reading from a file
  • make a directory including parent directories
  • copying files and directories
  • deleting files and directories
  • converting to and from a URL
  • listing files and directories by filter and extension
  • comparing file content
  • file last changed date
  • calculating a checksum

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 :

  • Incase you are using JARs from selenium-java-3.9.1 client, the JAR containing org.apache.commons.io is not being added to your project.
  • Incase you are using Maven with selenium-java-3.9.1 client dependency the modules containing FileUtils Class have been excluded.

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.

Shashank Gupta

The line FileUtils.copyFile(); has been updated to FileHandler.copy()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!