我正在尝试使用python-selenium API(版本2.53.6)在不同的浏览器上执行GUI测试。当我尝试以下列方式使用IE(11.0.10240)时(Windows Server 2012 R2 Standard,64bit);使用身份验证:
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.
有没有办法解决这个错误?
附录:
答案 0 :(得分:1)
没有直接回答这个问题,但是当我在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身份验证背后的图像。
使用硒2.53.5。
答案 1 :(得分:0)
您是否尝试过这种方式?
driver.current_url( “http://user:password@my.test.server.com”)