Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using chromedriver with selenium/python/ubuntu

I am trying to execute some tests using chromedriver and have tried using the following methods to start chromedriver.

driver = webdriver.Chrome('/usr/local/bin/chromedriver') 

and

driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver') 

and

import os from selenium import webdriver  chromedriver = "/usr/local/bin/chromedriver" os.environ["webdriver.chrome.driver"] = chromedriver driver = webdriver.Chrome(chromedriver) driver.get("http://stackoverflow.com") 

But none of these seems to help and the error is : selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.

I have checked multiple times and chromedriver is present in location /usr/local/bin.

Still my scripts are not working. Could any body pls help.

My google-chrome location is : /usr/bin/google-chrome

like image 604
Saheb Avatar asked Mar 18 '14 10:03

Saheb


People also ask

Where is Chromedriver in Selenium Python?

Now we need to move ChromeDriver somewhere that Python and Selenium will be able to find it (a.k.a. in your PATH ). The easiest place to put it is in C:\Windows .


1 Answers

Following the suggestion from https://askubuntu.com/questions/539498/where-does-chromedriver-install-to I was able to make it work like this:

  1. Installed the chromium-chromedriver:

    sudo apt-get install chromium-chromedriver 
  2. Adding the path to the selenium line:

    driver = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver") 

Note that this opens Chromium and not Chrome. Hope it was helpful.

like image 196
Zamfir Stefan Avatar answered Oct 19 '22 13:10

Zamfir Stefan