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".
If you want you can add a specific path here and you can move the chromedriver to this folder but as you see, /usr/local/bin folder is defined as a path by default. Now, go to your downloads folder, find the chromedriver_mac64. zip file and unpack it. You will see the chromedriver executable file.
Go to the terminal and type the command: sudo nano /etc/paths. Enter the password. At the bottom of the file, add the path of your ChromeDriver. Type Y to save.
ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors. If you are unfamiliar with Selenium WebDriver, you should check out the Selenium site.
Make it executable:
In CentOs use chmod +x chromedriver
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With