11

I am trying to use the python-selenium API (version 2.53.6) to perform GUI tests on different browsers. When I try to use IE (11.0.10240) in the following way (Windows Server 2012 R2 Standard, 64bit); using authentication:

driver = webdriver.Ie()
driver.get("http://user:password@my.test.server.com")

then I get the following error message:

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.

Is there a way to fix this error?

Addendum:

  • I have been trying to use the 32bit version of the IE driver, no success (same error)
  • I have changed the registry as explained here, no success (same error)
  • I have set "Enable Protected Mode" for all zones (also suggested here).
Community
  • 1
  • 1
Alex
  • 41,580
  • 88
  • 260
  • 469
  • If you try to navigate to some other site, does it work? It may have to do with using http... Also, when you say you have set "Enable Protected Mode", you mean you are disabling it, correct? Also, try playing with the settings in Internet Options>Advanced under Security section – drez90 Jul 08 '16 at 16:28

2 Answers2

1

Not directly answering the question, but I could not reproduce it when using IE11 on Windows 10 through BrowserStack and opening 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")

No errors and I see the image that is behind the HTTP auth.

Using selenium 2.53.5.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • If I try this I get a 404-error in the `webdriver.Remote` line. I also stronly prefer to get a driver as given in my example code, i.e. to have a method that returns the correct and working driver (without the need to specify a specific URL beforehand...). – Alex Jul 12 '16 at 13:28
  • @Alex the custom `command_executor` url here is just because I am on mac and using the remote browserstack selenium server and firing up `IE` there. Then, I navigate to the particular `httpwatch` page just to demonstrate that I can access the image behind the basic http auth. Note that if you want to run this example, you need to replace `username` and `key` with your specific browserstack credentials. – alecxe Jul 13 '16 at 17:04
  • I don't want to use browserstack... Maybe selenium just does not work for IE on purpose? – Alex Jul 15 '16 at 05:55
0

Have you tried using it this way ?

driver.current_url("http://user:password@my.test.server.com")

Technologeek
  • 190
  • 1
  • 2
  • 13
  • Seems like 'current_url' is a string which I cannot call. I get an error `TypeError: 'str' object is not callable` ... – Alex Jul 15 '16 at 08:36
  • Do you mind sharing a few more details ? Like >What version of python you're using ? >Which header imports have you called in the program ? >Basically post your entire code if possible ? – Technologeek Jul 15 '16 at 08:54