I have a config class that references a chromedriver.exe file via a String path like so
public static final String CHROMEDRIVER_DIRECTORY = "C:\\Users\\asdf\\Desktop\\Testing\\drivers\\chromedriver.exe";
That code is located in the src folder while the chromedriver.exe is located in a separate drivers folder. The project layout looks something like this.
Testing
How can I edit the string so that it can find the chromedriver without having to type the absolute path? Thanks
试试“drivers\\\\chromedriver.exe”。
Keep your chromedriver.exe in one folder in your current project directory(say win ). Then use
System.getProperty("user.dir") + File.separator + "win" + File.separator + "chromedriver.exe"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.