Selenium-不支持提示用户类型提示的用户提示
很长时间以来,我一直在使用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()
但是昨天它抛出了这个错误:
selenium.common.exceptions.WebDriverException:消息:不支持使用提示用户类型提示用户提示
我一直在搜索,但是我什至找不到关于这种异常以及如何处理该问题的结果。
有任何想法吗?
提前致谢!
-
似乎目前没有任何驱动程序支持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)