试图让firefox在Spyder中使用selenium运行。我当前的代码是
from selenium import webdriver
import os
os.environ["PATH"] += ":/usr/local/bin/geckodriver"
browser = webdriver.Firefox()
我仍然得到这个错误:
runfile('/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder/test.py',
wdir='/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder')
Traceback (most recent call last):
File "<ipython-input-1-3f3f96ccf515>", line 1, in <module>
runfile('/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder/test.py',
wdir='/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder')
File "/Applications/anaconda3/lib/python3.6/site-
packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/Applications/anaconda3/lib/python3.6/site-
packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder/test.py",
line 12, in <module>
browser = webdriver.Firefox()
File "/Applications/anaconda3/lib/python3.6/site-
packages/selenium/webdriver/firefox/webdriver.py", line 152, in
__init__
self.service.start()
File "/Applications/anaconda3/lib/python3.6/site-
packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
WebDriverException: 'geckodriver' executable needs to be in PATH.
尽管gekodriver在那个文件夹中。
Last login: Fri Apr 20 10:57:16 on ttys000
dhcp-54-85:~ mherl$ nano ./bash_profile
dhcp-54-85:~ mherl$ nano .bash_profile
GNU nano 2.0.6 File: .bash_profile
Modified
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# added by Anaconda3 5.1.0 installer
export PATH="/Applications/anaconda3/bin:$PATH"
#added by mherl to show path to gekodriver
export PATH=$PATH:/usr/local/bin/gekodriver
/usr/local/bin
/Users/mherl/Dropbox/AnacondaProjects/MWS/MWSSpyder
/usr/local/bin
如果这很重要的话,这是一个运行高塞拉的mac。
此错误消息...
WebDriverException: 'geckodriver' executable needs to be in PATH.
...暗示在预期的默认位置没有找到GeckoDriver。
当您使用基于MAC的系统时,您需要传递executable_path键以及引用GeckoDriver绝对路径的值,如下所示:
from selenium import webdriver
browser = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')
你有关于我做错什么的线索吗?
$brew安装chromedriver-找不到bash:brew:命令 我下载了chrome驱动程序,甚至把它放在了工作目录中。仍然会出现这个错误。我几乎不知道python是什么。请帮忙。
我非常熟悉在selenium中使用chromedriver,我现在尝试使用geckdriver,但由于某些原因,我不断收到错误信息,geckodriver可执行文件需要在PATH中 我使用Python遵循了Selenium中的步骤-Geckodriver可执行文件需要在PATH中 > 我在环境变量中的path中添加了gecko驱动程序 我将firefox更新为最新版本 我用了二进制方法 把壁虎司机
问题内容: 试图让Firefox在spyder中使用硒运行。我当前的代码是 我仍然收到此错误: 即使gekodriver在该文件夹中。 证明gekodriver位置正确 我也尝试过将路径导出到〜。/ bash_profile,现在看起来像这样。 我还在spyder中设置了当前路径: gekodriver在其中 我到处都看过,大多数人说如果它位于/ usr / local / bin中,它应该自动运
我写了这个: 我得到了以下错误: 回溯(最近一次调用):文件“C:\Users\atrei\AppData\Local\Programs\Python38-32\lib\site packages\selenium\webdriver\common\service.py”,第72行,在start self中。进程=子进程。Popen(cmd,env=self.env,文件“C:\Users\atr