Chomedriver “The driver is not executable”

一笑奈何 提交于 2021-02-16 16:16:09

问题


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

ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
LoggingPreferences log_prefs = new LoggingPreferences();
log_prefs.enable(LogType.BROWSER, Level.SEVERE);
capabilities.setCapability(CapabilityType.LOGGING_PREFS, log_prefs);
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver(capabilities);
driver.manage().window().maximize();

And it's ok on local windows (if we change "chromedriver" to "chromedriver.exe") , but when i'm running it on CentOS i got error message: "The driver is not executable".


回答1:


Make it executable: In CentOs use chmod +x chromedriver




回答2:


  1. If User is using Unix that time first checks folder or chromedriver permission.
  2. Permission is missing then use below command.
  3. chmod 777 *
  4. Above command change folder permission and Issue will resolve.



回答3:


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.




回答4:


I ran into this problem as well. The first two answers given worked for me but you can also resolve the permission issue by going to the file (gecko file) that you have in your folder, right click>>Properties and then change the permissions from there.




回答5:


my driver files were in my eclipse project - resources folder. Funny thing - if you go to the driver and check the properties of chromedriver exe file. It did not have the execute permissions. set that and apply and close. I was good to go.



来源:https://stackoverflow.com/questions/25720724/chomedriver-the-driver-is-not-executable

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