Ser*_*hka 6 python firefox selenium selenium-webdriver geckodriver
from selenium import webdriver;
browser= webdriver.Firefox();
browser.get('http://www.seleniumhq.org');
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此代码时,它给了我一个error message
:
Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line.
Run Code Online (Sandbox Code Playgroud)
任何想法 - 高度赞赏!
Deb*_*anB 11
这个错误信息...
Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line.
Run Code Online (Sandbox Code Playgroud)
...暗示GeckoDriver无法在默认位置找到Firefox二进制文件。此外,您还没有通过moz:firefoxOptions.binary
能力。
可能在您的系统中,firefox安装在自定义位置,在这些情况下,您需要通过功能传递Firefox二进制文件的绝对路径,如下所示:moz:firefoxOptions.binary
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'
driver = webdriver.Firefox(executable_path=r'C:\WebDrivers\geckodriver.exe', firefox_options=options)
driver.get('http://google.com/')
Run Code Online (Sandbox Code Playgroud)
您可以在以下位置找到一些相关的详细讨论:
同样的问题在这里:
Mac
Firefox
应用程序geckodriver
,可以在PATH
Firefox
归档时间: |
|
查看次数: |
15753 次 |
最近记录: |