Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

I have solved the issue in the following way:

  1. Open a terminal and type whereis chromedriver. In my case, I had the following output:

    chromedriver: /usr/local/bin/chromedriver

  2. Copy that path and edit your Webdriver instance like:

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

That should be enough!

Solution 3:

The following should normally work:

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

Note that in your question there was no preceding '/' in the path.

Additionally, make sure that the chromedriver executable located in /usr/local/bin/ has appropriate file permissions, i.e. that it can be executed:

> chmod 777 /usr/local/bin/chromedriver

Solution 4:

As the message says: ChromeDriver executable needs to be available in the path.

So is it in the path? What is the output of:

$ cd$ chromedriver --version

If you don’t see the version, chromedriver is definitively not in the PATH.

I don’t tell webdriver where to find chromedriver otherwise. – I use the Ubuntu package “chromium-chromedriver”, but it drops the binary in /usr/lib/chromium-browser/chromedriver, which is not in my PATH. So I put a soft link in /usr/bin.

Solution 5:

You need to make sure the standalone ChromeDriver binary is either in your path or available in the webdriver.chrome.driver environment variable and then try to use absolute path to that binary. Below is the code for java -

FilechromeDriver=newFile("/usr/bin/chromedriver");
    System.setProperty("webdriver.chrome.driver", chromeDriver.getAbsolutePath());
    driver = newChromeDriver();

Post a Comment for "Using Chromedriver With Selenium/python/ubuntu"