我是自动化测试的新手,虽然我的 Selenium 测试在 Chrome 和 Firefox 上运行,但它们不在 IE11 上运行。我做了下面详述的所有检查,但我一直遇到这个错误:
org.openqa.selenium.WebDriverException: Failed to navigate to http://myapp. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.
我首先做了所需的配置,如 https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration )。
我已尝试按照 In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed 中的建议编辑我的注册表 向 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE 添加一个名为 iexplore.exe 且值为 0 的新 DWORD 值,如 https://stackoverflow.com/users/80779/lordofthepigs 所述
我也试过引入https://stackoverflow.com/users/4210466/karunakar-sapogu建议的那段代码:
new_window = self.driver.window_handles[1]
self.driver.switch_to_window(new_window)
但我似乎没有正确介绍它,因为我遇到了 java 错误。
有人用 Java 解决过这个问题吗?你能给我一步一步的指导吗?
最佳答案
1) 您确定您的 IEdriver 实例正在运行吗?
2) 您使用的是 IEdriver x64 还是 IEDriver x86?
即使您使用 x64 windows,在大多数情况下您也使用 internet exlporer x86。请尝试 x86 驱动程序并尝试重现此类行为
关于selenium-webdriver - IE11 Selenium WebDriverException:导航失败。 (org.openqa.selenium.WebDriverException ...IWebBrowser2::Navigate2() 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32119931/