我的系统(windows7pro64位,python3.5通过Anaconda)设置为通过selenium使用Firefox,遵循Python的测试驱动开发这本书。Python仍然抛出错误WebDriverException: 'geckodriver.exe' executable needs to be in PATH.
,即使我已经将我的系统路径设置为指向geckodriver的文件夹(并重新启动了3次)。在
如果我将python/selenium指向geckodriver.exe
的确切位置,就会得到以下错误
OSError: [WinError 216] This version of %1 is not compatible with the
version of Windows you're running. Check your computer's system information
to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program,
and then contact the software publisher
现在我不确定错误版本%1
是否与firefox版本错误(我尝试过64位和32位)、geckodriver、selenium或其他完全不同的版本有关。在
请确保您已经下载了GeckoDriver for win-64 bit,因为您有64位计算机。现在复制粘贴下载的GeckoDriver可执行文件在'Script'文件夹中(这个文件夹位于系统中安装python的根文件夹中)。现在在环境变量中设置python根文件夹和“Script”文件夹的路径
别忘了重新启动系统以使更改生效&请尝试以下示例代码
^{pr2}$wires.exe
(github-geckodriver issue 90)的驱动程序。从Selenium3
起,该驱动程序已替换为geckodriver.exe
。通过运行pip install "selenium>=3.0.0"
安装/升级到最新的seleniumversion %1
错误与错误的geckodriver版本有关。将此zip解压缩到C:\Users\YourUserName\Downloads\selenium_driver
C:\Program Files\Mozilla FirefoxESR
(如果是64位的话)或{如果setting the Windows PATH到{}似乎不起作用(这样
selenium
可以找到geckdriver.exe
),则可以改为在Python脚本中指定其目录,如下所示:相关问题 更多 >
编程相关推荐