我正在尝试使用 python-selenium API(版本 2.53.6)在不同的浏览器上执行 GUI 测试。当我尝试以下列方式使用 IE (11.0.10240) 时(Windows Server 2012 R2 Standard,64 位);使用身份验证:
driver = webdriver.Ie()
driver.get("http://user:password@my.test.server.com")
然后我收到以下错误消息:
selenium.common.exceptions.WebDriverException: Message: Failed to navigate to http://user:password@my.test.server.com. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.
有没有办法解决这个错误?
附录:
最佳答案
没有直接回答问题,但是我在 Windows 10 上通过 BrowserStack 使用 IE11 并打开 this http auth protected page 时无法重现它:
from selenium import webdriver
desired_cap = {'os': 'Windows', 'os_version': '10', 'browser': 'IE', 'browser_version': '11.0'}
driver = webdriver.Remote(
command_executor='http://usename:key@hub.browserstack.com:80/wd/hub',
desired_capabilities=desired_cap)
driver.get("http://httpwatch:password1@www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx?0.7349707232788205")
没有错误,我看到了 HTTP 身份验证背后的图像。
使用 Selenium 2.53.5。
关于python - 如何使用 selenium 中的 IE webdriver for python(无法导航错误)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38224983/