相关疑难解决方法(0)

错误消息:"'chromedriver'可执行文件需要在路径中可用"

我正在使用selenium和python,并从我的网站下载了我的Windows计算机的chromedriver:http://chromedriver.storage.googleapis.com/index.html?path = 2.15 /

下载zip文件后,我将zip文件解压缩到我的下载文件夹.然后我将路径到可执行二进制文件(C:\ Users\michael\Downloads\chromedriver_win32)放入环境变量"路径".

但是,当我运行以下代码时:

  from selenium import webdriver

  driver = webdriver.Chrome()
Run Code Online (Sandbox Code Playgroud)

...我一直收到以下错误消息:

WebDriverException: Message: 'chromedriver' executable needs to be available in the path. Please look at     http://docs.seleniumhq.org/download/#thirdPartyDrivers and read up at http://code.google.com/p/selenium/wiki/ChromeDriver
Run Code Online (Sandbox Code Playgroud)

但是 - 如上所述 - 可执行文件是(!)在路径中...这里发生了什么?

python selenium selenium-chromedriver

126
推荐指数
11
解决办法
24万
查看次数

使用Selenium和Chromium Browser

在Selenium选项(在Firefox上)我可以找到Custom browser.

是否可以使用此选项在Chromium Browser(而不是Chrome)中运行Selenium测试?

compatibility selenium web-testing chromium

17
推荐指数
4
解决办法
3万
查看次数

蟒蛇硒和铬

我在我的 Mac 上通过 anaconda 运行 selenium。为了能够选择 Chrome 作为我的 webdriver,我需要下载最新的 chromedriver。但我无法弄清楚将文件放在路径中的位置。如果我只是跑

driver = webdriver.Chrome()

WebDriverException: Message: unknown error: cannot find Chrome binary
Run Code Online (Sandbox Code Playgroud)

我应该把 chromedriver 放进去,anaconda/lib/python2.7/site-packages/selenium/webdriver/如果是的话,我如何指定 selenium 来使用它?

我知道它必须很简单,因为我已经像一年前一样在另一台计算机上设置了 chromedriver,但我现在无法访问它。

编辑:试过这个

import os
from selenium import webdriver

chromedriver = "/Users/username/Downloads/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver)
driver.get("http://stackoverflow.com")
driver.quit()
Run Code Online (Sandbox Code Playgroud)

得到这个错误:

WebDriverException: Message: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.23.409710 (0c4084804897ac45b5ff65a690ec6583b97225c0),platform=Mac OS X 10.11.6 x86_64)
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome

11
推荐指数
3
解决办法
2万
查看次数

在Mac上将硒与chromedriver一起使用

我想在Mac上将硒与chromedriver一起使用,但遇到了一些麻烦。

  1. 我从下载chromedriver ChromeDriver-WebDriver for Chrome
  2. 但我不想将其放入PATH。

在此处输入图片说明

import os

from selenium import webdriver

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DRIVER_BIN = os.path.join(PROJECT_ROOT, "bin/chromedriver_for_mac")
print DRIVER_BIN
browser = webdriver.Chrome(DRIVER_BIN)
browser.get('http://www.baidu.com/')
Run Code Online (Sandbox Code Playgroud)

但是我无法获得想要的结果。

Traceback (most recent call last):
  File "/Users/wyx/project/python-scraping/se/test.py", line 15, in <module>
    browser = webdriver.Chrome(DRIVER_BIN)
  File "/Users/wyx/project/python-scraping/.env/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
    self.service.start()
  File "/Users/wyx/project/python-scraping/.env/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver_for_mac' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of …
Run Code Online (Sandbox Code Playgroud)

python selenium

8
推荐指数
3
解决办法
2万
查看次数

尝试使用selenium webdriver在linux上启动chrome驱动程序

我试着找到答案而不能,现在我自己问.

我写了简单的测试

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r"/home/tranter/workspace/chromedriver")
driver.get("http://www.python.org")
driver.close()
Run Code Online (Sandbox Code Playgroud)

比我有追溯

> tranter@tranter-VirtualBox:~/workspace$ python testchrome.py Traceback
> (most recent call last): File "testchrome.py", line 6, in <module>
> driver =
> webdriver.Chrome(executable_path=r"/home/tranter/workspace/chromedriver")
> File
> "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py",
> line 65, in __init__ keep_alive=True) File
> "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 73, in __init__ self.start_session(desired_capabilities,
> browser_profile) File
> "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 121, in start_session 'desiredCapabilities':
> desired_capabilities, File
> "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 173, in execute self.error_handler.check_response(response) File
> "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py",
> line 166, …
Run Code Online (Sandbox Code Playgroud)

python linux selenium selenium-chromedriver

3
推荐指数
2
解决办法
7842
查看次数

selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中

在此处输入图片说明我正在尝试使用 python 和 selenium 自动化我的 Web 应用程序,我面临以下问题。

环境 - Mac/Python/Selenium IDE - PyCharm

selenium.common.exceptions.WebDriverException: 消息:'chromedriver' 可执行文件需要在 PATH 中。请参阅 https://sites.google.com/a/chromium.org/chromedriver/home

请帮我解决这个问题。

python selenium pycharm selenium-chromedriver

3
推荐指数
1
解决办法
1万
查看次数