python - 如何使用 selenium 中的 IE webdriver for python(无法导航错误)?

标签 python internet-explorer selenium selenium-webdriver

我正在尝试使用 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.

有没有办法解决这个错误?

附录:

  • 我一直在尝试使用32位版本的IE驱动,没有成功(同样的错误)
  • 我已经按照说明更改了注册表 here , 没有成功(同样的错误)
  • 我已为所有区域设置“启用保护模式”(也建议 here)。

最佳答案

没有直接回答问题,但是我在 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/

相关文章:

python - get_do_sorting_url 上的 django-admin-sortable NoReverseMatch 错误

javascript - Internet Explorer 不保存打开文件对话框中的路径

selenium - 如何在Selenium中的 headless (headless)Firefox中使用--screenshot和python

python - 如何处理 Selenium 中的奇怪字符? 'utf8' 编解码器无法解码位置 0 中的字节 0xc3 :

java - 需要帮助来点击一个函数

python - 解析CSV文件中某些列中的逗号Python

python - Django UNIQUE 约束失败

Python - 取消定时器线程

javascript - JQuery 滚动在 Internet Explorer 或 Firefox 中不起作用

javascript - Internet Explorer 支持第 n 个子选择器