Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 261
user2572003 Avatar asked Jan 30 '14 08:01

user2572003


3 Answers

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_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_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

like image 56
LordOfThePigs Avatar answered Nov 13 '22 02:11

LordOfThePigs


You must set the Protected Mode settings for each zone to be the same value in the Internet Explorer. Hope the below link may be helpful to you.

NoSuchElementException is occurred during implementation of InternetExplorerDriver in Selenium WebDriver

Regards,

Vignesh

like image 3
Vignesh Avatar answered Nov 13 '22 02:11

Vignesh


I resolved this issue by manually running internet explorer. When the browser loaded, I was prompted with a dialog to 'Set up Internet Explorer 11'. I selected 'Use recommended security, privacy, and compatibility settings' and clicked 'OK'.

After the dialog closed, my browser displayed a configuration page called 'Caution: Internet Explorer Enhanced Security Configuration is not enabled' - I ignored this and closed the browser and tried running the automation test again with success.

like image 2
coltdorsey Avatar answered Nov 13 '22 03:11

coltdorsey