19

The code below is showing an error as if the file does not exist. I can find the chromedriver.exe file, but the .exe file seems to be non-executable.

These are my commands:

System.setProperty("webdriver.chrome.driver","driver = webdriver.Chrome(executable_path='/usr/local/share/chromedriver')"); 
WebDriver driver = new ChromeDriver();
driver.get("https://www.youtube.com/");

What may cause this dis-functionality?

zx485
  • 2,426
GoviKG
  • 201

1 Answers1

36

You can use chromium-chromedriver:

sudo apt-get install chromium-chromedriver

Or download proprietary ChromeDriver and use it:

wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
./chromedriver

You need to install selenium python packages:

sudo apt-get install python-selenium python3-selenium

It works with Google's Getting started python program:

import time
from selenium import webdriver

driver = webdriver.Chrome('./chromedriver')  # Optional argument, if not specified will search path.
# or '/usr/lib/chromium-browser/chromedriver' if you use chromium-chromedriver
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
N0rbert
  • 99,918