0

I'm using 32-bit IE11 on Win8.1. I have some Selenium scripts (Python bindings) which I execute on IE11 among others.

With IEDriverServer, I've done all the steps suggested on the InternetExplorerDriver-wiki page and in general the IEDriver works fine.

However, if I try to get a local HTML page, such as:

from selenium import webdriver
ie = webdriver.Ie()
url = "file:///D:/dev/proof_of_concept/html/liki.html"
ie.get(url)
print(ie.current_url)

I get this exception in return:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 426, in current_url
return self.execute(Command.GET_CURRENT_URL)['value']
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 173, in execute
self.error_handler.check_response(response)
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: 'Unable to get browser'

There are many threads about the general IE11 issue (with the registry solution) but I weren't able to find any solution for this particular issue with local pages.

Is there some kind of limitation, or something related to the security zones, that I'm not aware of?

Thanks!

jgangso
  • 638
  • 10
  • 19
  • http://stackoverflow.com/questions/28196819/selenium-webdriver-suddenly-stopped-working-in-ie/28196882#28196882 – Saifur Feb 05 '15 at 14:22
  • Thanks for reply. However, the suggested resolution addresses a whole different issue, which I have already fixed earlier. Let me emphasize that so far I have managed to isolate the issue to local files. With normal web pages there are no problems. – jgangso Feb 05 '15 at 14:31
  • I know that it's just a known issue I was pointing you to before banging your head against the wall because `IE` does not work. I do that all the time :P – Saifur Feb 05 '15 at 14:35

1 Answers1

4

The IE driver doesn't support opening HTML documents using the file:// protocol. There are a number of reasons for this, but there are two in particular that feature prominently. First, JavaScript is disabled by default for documents opened in IE using the file:// protocol. Since the IE driver requires JavaScript to function properly, this is a non-starter. Secondly, documents opened using the file:// protocol are opened in a separate Protected Mode zone, one not normally displayed in the Options dialog. As such, it's not possible to avoid crossing a Protected Mode boundary, and when such a boundary is crossed, the COM objects the driver uses to automate IE get orphaned.

It's not difficult to launch a simple web server with which to serve up the documents you're interested in automating. That would be the correct way forward.

JimEvans
  • 27,201
  • 7
  • 83
  • 108