Answer a question

Here is the error message I'm getting:

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Scott\workspace\Twitch%20Bot%20v2\bin\chromedriver.exe
    at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:122)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:117)
    at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
    at com.fatalcubez.main.Bot.setup(Bot.java:41)
    at com.fatalcubez.main.Bot.<init>(Bot.java:29)
    at com.fatalcubez.main.BotGUI.<init>(BotGUI.java:17)
    at com.fatalcubez.main.Main.main(Main.java:14)

And here is the code that I'm using:

ClassLoader loader = ClassLoader.getSystemClassLoader();
        URL path = loader.getResource("chromedriver.exe");
        System.setProperty("webdriver.chrome.driver", path.getPath());

I've already check the directory for where it is searching for the chromedriver and it's there. I'm not sure what the problem is at this point. Any help would be great!

EDIT: It was simply a problem with spacing in the folder name, but now I have another problem. When I try to launch chrome it says "An administrator has installed chrome on this computer...." What can I do?

Answers

You have to give your chromeDriver.exe file path instead of taking the path from the URL.

example:

 System.setProperty("webdriver.chrome.driver",
            "C:\\Downloads\\chromedriver.exe");
Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐