3

I am new to automated testing and, though my Selenium tests are running on Chrome and Firefox, they are not running on IE11. I did all the checks I detail below, but I keep on bumping into this error:

org.openqa.selenium.WebDriverException: Failed to navigate to http://myapp. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.

I did first the required configuration as in https://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration) .

I have tried editing my registry as suggested at In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed to 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 by https://stackoverflow.com/users/80779/lordofthepigs

I also tried introducing the piece of code suggested by https://stackoverflow.com/users/4210466/karunakar-sapogu :

new_window = self.driver.window_handles[1]   
self.driver.switch_to_window(new_window)

But I seem not to be introducing it right because I got java errors.

Has anyone solved this problem in Java? Could you give me step by step instructions?

DebanjanB
  • 118,661
  • 30
  • 168
  • 217

3 Answers3

1

1) Are you sure that is your IEdriver instance run?

2) Did you use IEdriver x64 or IEDriver x86?

Even if you use x64 windows, in most cases you use internet exlporer x86. Please, try x86 driver and try to reproduce such behavior

Andrew
  • 5,048
  • 4
  • 35
  • 58
  • I manage to get IE browser open and to have it go to my homepage, but then it won´t go to the second link. I use x64 since my computer has windows 64bit – Cristina Gil Lamaignere Aug 26 '15 at 14:04
  • even if you use x64 windows, in most cases you use internet exlporer x86. Please, try x86 driver and try to reproduce such behavior. – Andrew Aug 27 '15 at 14:37
1

It worked! Thanks so much. The problem was that I had the 64 bit version. By replacing it with a 32 bit version, my code worked (I have the driver in System32, to bypass modifying the path)

    System.setProperty(webdriver.ie.driver", "C://Windows/System32/IEDriverServer.exe");
    driver = new InternetExplorerDriver();
    baseUrl = "http://mysite";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
Ripon Al Wasim
  • 34,088
  • 37
  • 146
  • 165
0

This error message...

org.openqa.selenium.WebDriverException: Failed to navigate to http://myapp. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed

...implies that the IEDriverServer was unable to initiate/spawn a new Browsing Context i.e. Internet Explorer Browser session as a COM object.


Required Configuration for Internet Explorer Driver

The Required Configuration of Internet Explorer Driver clearly mentions:

  • The IEDriverServer exectuable must be downloaded and placed in your PATH.
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".

ProtectedModeSettings

  • Additionally, Enhanced Protected Mode must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For Windows 10, you also need to set Change the size of text, apps, and other items to 100% in display settings.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates.
  • For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
  • For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
  • Note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Inside this key, create a DWORD value named iexplore.exe with the value of 0`.

Solution

First, you need to ensure that the Protected Mode settings for each zone to be the same value. Additionally you also need to ensure the Required Configuration for Internet Explorer Driver.


References

You can find a couple of relevant discussions in:

DebanjanB
  • 118,661
  • 30
  • 168
  • 217