摘要: Geckodriver 似乎无法识别,尽管它已在 SYSTEM PATH 中准确设置
当前系统配置:
操作系统:Windows 10;版本:1909;操作系统版本:18363.752;系统类型:64 位操作系统 Windows 系统信息
已安装Microsoft Visual Studio 可再发行运行时:vc_redist.x64.exe
用户环境变量值:“C:\Users\PCUserName\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\PCUserName\AppData\Local\Programs\Python\Python38\;%IntelliJ IDEA Community Edition% ;C:\Program Files\Java\jdk-13.0.1\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Development\Selenium Resources\Selenium Drivers\geckodriver.exe;C:\Development\Selenium Resources\Selenium Drivers\chromedriver.exe;C:\Development\Selenium Resources\Selenium Drivers\;C:\Development\Selenium Resources\Selenium Drivers;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program文件\Git\cmd;C:\Program Files\Microsoft VS Code\bin;"
系统环境变量值:“%path%;C:\Development\Selenium Resources\Selenium Drivers;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Ruby26-x64\bin;C: \Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows \System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jre1.8.0_221\bin\javaw.exe ;C:\Program Files\Java\jdk-12.0.2\bin;C:\Users\PCUserName\AppData\Local\Programs\Python\Python38;C:\Users\PCUserName\AppData\Local\Programs\Python\Python38 \Scripts;C:\Development\Selenium Resources\Selenium Drivers\;C:\Development\Selenium Resources\Selenium Drivers\chromedriver.exe;C:\Development\Selenium Resources\Selenium Drivers\geckodriver.exe;"
Selenium Driver 的保存目录:C:\Development\Selenium Resources\Selenium Drivers Selenium Drivers Directory
安装的 Firefox 浏览器版本:74.0(64 位)
安装的 Geckodriver 版本:geckodriver-v0.26.0-win64.zip 从这里:https ://github.com/mozilla/geckodriver/releases
Github 项目(最新):https ://github.com/cikent/Selenium-Projects/tree/master/Selenium-PythonProjects/python-webui-testing
目标/目标: 解决 Geckodriver 未被检测到的问题,因此我可以通过参考 Automation Panda 的以下指南继续使用 Selenium 和 Pytest 在 Python 中设置自动化框架:https ://blog.testproject.io/2019/07/16/read -config-files-in-python-selenium/
我已经尝试过什么?:
- 每次更新环境变量后重新启动系统
- 从 Powershell 终端启动 geckodriver,运行:geckodriver
- 确保安装了 Microsoft Visual Studio 可再发行组件以解决此处针对 Windows v0.26.0 调用的以下错误(如上所述):
- 使用以下命令验证我的 Github 项目执行得很好:pipenv run python -m pytest当我的配置文件config.json将浏览器参数设置为:chrome
- 在 Google、Stackoverflow、Reddit 上搜索数小时,并试图解决为什么这不起作用...... :(
实际结果: 当我执行时:pipenv run python -m pytest从以下目录:C:\Development\Selenium-Projects\Selenium-PythonProjects\python-webui-testing,我得到: PowerShell Execution of Pytest & Output