Joey Jiao
Joey Jiao

Reputation: 91

Path to chromedriver on Linux

I put the chromedriver in a random folder. And wish to call it to use webdriver from selenium

But actually on: https://code.google.com/p/selenium/wiki/ChromeDriver, says it expects the driver to be under: /usr/bin/google-chrome

I'm using dreamhost, and they told me I need to pay more to sudo /usr/bin folder. Anyway to walk around those? (namely, execute chromedriver from random location)

I tried the following (found from anther question about the same topic but no exact answer)

chromedriver =  "path/to/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
browser = webdriver.Chrome(chromedriver)

But it doesn't work. It gave me error: cannot find Chrome binary Seems like another problem:(

Thanks ahead, it's gonna be very helpful! Btw I'm using Python/Flask

Upvotes: 0

Views: 5219

Answers (2)

srees
srees

Reputation: 296

You can pass chromedriver location using executable_path variable. Please find below sample code:

from selenium import webdriver

driver = webdriver.Chrome(executable_path="/path/to/chromedriver")
driver.get("https://code.google.com/p/chromedriver/issues/detail?id=1260")

Upvotes: 1

Scott.Rowe
Scott.Rowe

Reputation: 1

You need to add the location of chrome driver to your PATH.

PATH=$PATH:[random folder path]

after that you should be able to run chromedriver and get something like:

Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 9515 Only local connections are allowed.

Upvotes: 0

Related Questions