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.
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.
下载chrome 驱动程序并使用此代码
driver = webdriver.Chrome("C:\\chromedriver.exe")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.