Chomedriver “The driver is not executable”

后端 未结 5 986
时光说笑
时光说笑 2021-01-18 03:08

I have my chromedriver and chromedriver.exe right in project folder. I\'m creating instance of driver with this code.

ChromeOptions options = new ChromeOptio         


        
5条回答
  •  时光说笑
    2021-01-18 03:41

    I had same problems but in my case the everything was working fine but suddenly I started getting this error, so It wouldn't be access problem I thought.

    So for reference to set the chrome driver or firefox driver I was using below snippet.

    Utils.setSystemProperty("webdriver.chrome.driver",
                    classLoader.getSystemResource("utilityJars" + File.separator + "chromedriver_mac").getPath());
    

    I think case the path is in target folder when classes are compiled. So the value of

    classLoader.getSystemResource("utilityJars" + File.separator + "chromedriver_mac").getPath()
    

    is

    /{user.dir}/target/classes/utilityJars/chromedriver_mac

    So may be it had some issue accessing chromedriver on that path, may be not compiled or something not sure, but I just deleted the target folder and re-executed it and it worked.

提交回复
热议问题