Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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

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://google.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 the chromedriver is present in location /usr/local/bin.

Still, my scripts are not working. Could anybody pls help.

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

1 Answer

0 votes
by (62.9k points)

I have had the same issue, I was able to make it work using the following steps:

  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.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s automation testing course!

Browse Categories

...