Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
613 views
in Technique[技术] by (71.8m points)

internet explorer - In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed

I am using Selenium to write test cases for my web application. When I run the test from Firefox it's working fine, but when I try to run it from IE I am not able to run and I get the error message:

This usually means that a call to the COM method IWebBrowser2::Navigate2() failed exception.

System.setProperty("webdriver.ie.driver", "browserdrivers/IEDriverServer.exe");
WebDriver web =  new InternetExplorerDriver();
web.get("URL");

I am able to see IE screen but it's not navigating to that URL, and I am getting above exception. How can I resolve this ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've just encountered that problem myself. For me, the problem was that my application uses HTTP Basic Authentication, and that I was attempting to set the username/password combination via the page URL, like this: http://username:password@host/path

Problem is by default IE doesn't allow you to set the username and password this way (it's a security feature), and that causes the error above.

To fix this, I had to add a registry value in regedit. In the key: HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMAINFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE add a new DWORD value with the name iexplore.exe and the value 0, as described in this other answer https://stackoverflow.com/a/23519791/80779


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...