【发布时间】:2020-07-09 13:45:27
【问题描述】:
总结: Geckodriver 似乎无法识别,尽管它已在系统路径中准确设置
当前系统配置:
操作系统:Windows 10;版本:1909;操作系统版本:18363.752;系统类型:64位操作系统 Windows System Info
已安装 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 社区版%;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 Files\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 驱动程序的目录: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 Redistributable 以解决此处针对 Windows v0.26.0 调用的以下错误(如上所述):
- 使用以下命令验证我的 Github 项目执行得很好:pipenv run python -m pytest when my configuration file config.json 将 browser 参数设置为:chrome
- 在 Google、Stackoverflow、Reddit 等上进行了数小时的搜索,试图解决为什么这不起作用...:(
实际结果: 当我执行时: pipenv run python -m pytest 从以下目录:C:\Development\Selenium-Projects\Selenium-PythonProjects\python- webui-testing,我得到: PowerShell Execution of Pytest & Output
【问题讨论】:
标签: python selenium pytest geckodriver system-paths