coo*_*per 8 python firefox selenium-webdriver
很长时间以来,我一直在使用python机器人来完成一些工作任务。除其他外,机器人必须通过身份验证窗口。
python程序中的代码如下:
driver = webdriver.Firefox(firefox_profile=profile)
...
driver.get('https://example.com')
driver.switch_to.alert.send_keys('123456' + Keys.TAB + '123456')
driver.switch_to.alert.accept()
Run Code Online (Sandbox Code Playgroud)
但是昨天它抛出了这个错误:
selenium.common.exceptions.WebDriverException:消息:不支持提示用户类型的用户提示
我一直在搜索,但是我什至没有找到有关这种异常以及如何处理此问题的结果。
有任何想法吗?
提前致谢!
小智 7
我没有足够的代表发表评论,我知道这不能“解决”问题,但我能够通过使用Firefox ESR解决这个问题。
您可以在安装主 Firefox 的同时安装 ESR,然后指定 FirefoxDriver 将使用哪个二进制文件:
driver = webdriver.Firefox(firefox_profile=profile, firefox_binary="/path/to/esr/binary")
Run Code Online (Sandbox Code Playgroud)
小智 5
似乎目前没有任何驱动程序支持HTTPAuth对话框。
Firefox实施了一种变通办法,该变通办法在67.0中不再起作用。似乎由于缺少规范,他们现在无法开始添加对HTTP身份验证提示的支持。
https://bugzilla.mozilla.org/show_bug.cgi?id=1556026
https://bugzilla.mozilla.org/show_bug.cgi?id=1556307
https://github.com/w3c/webdriver/issues/385
我设法通过使用其他名称安装Firefox 66.0,然后在调用FirefoxDriver时提及其位置来解决此问题,就像@ elead1一样。
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver import Firefox
path = FirefoxBinary("/path/to/Firefox2/firefox-bin")
browser = Firefox(firefox_binary=path)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1779 次 |
| 最近记录: |