3

So I'm unable to figure out why I am getting this exception. When I run the chromedriver alone I get:

Starting ChromeDriver 2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3) on port 9515

When I try to run it from a file I get:

WebDriverException: Message: chrome not reachable (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Linux 3.13.0-52-generic x86_64)

The code:

if self.proxy:
    chrome_options = Options()
    chrome_options.add_argument("--proxy-server=http://user:password@proxy.com:8080")
    self.webdriver = webdriver.Chrome('/usr/bin/google-chrome', chrome_options=chrome_options)
else:
    self.webdriver = webdriver.Chrome('/usr/bin/google-chrome')

I'm running it without the proxy. If I don't supply the path, for some reason it won't be able to find the chrome binary. Not sure where I should go from here.

user3084860
  • 421
  • 5
  • 19

2 Answers2

0

The path you need to specify in the first positional or executable_path keyword argument is a path to the chromedriver, not the chrome itself:

self.webdriver = webdriver.Chrome('/path/to/chromedriver', chrome_options=chrome_options)

If chromedriver is in $PATH - you don't need to specify the path at all - this is usually the case.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • Hrm, makes sense. I had some issues with my paths. I fixed it up and am able to fire it up without even specifying a path now. But I still get the same error, sadly ( whether I specify the path or not ). – user3084860 May 13 '15 at 23:04
  • @user3084860 yeah, you are right, `chrome not reachable` is related to smth else. There are number of reasons according to what I've googled. Can you check if you get the same error instantiating chrome as just `self.webdriver = webdriver.Chrome()`? Thanks. – alecxe May 14 '15 at 06:15
0

download the chrome driver and use this code

driver = webdriver.Chrome("C:\\chromedriver.exe")
Shaik
  • 400
  • 3
  • 9