1

I run some tests in the robot framework which run fine with firefox and chrome but not with the Internet Explorer. I read other posts which recommend to set the security level to protected, which I did.

But then I get the following error:

WebDriverException: Message: Unexpected error launching Internet Explorer.
Mode must be set to the same value (enabled or disabled) for all zones.

webdriver.py-File:

DEFAULT_TIMEOUT = 30
DEFAULT_PORT = 0
DEFAULT_HOST = None
DEFAULT_LOG_LEVEL = None
DEFAULT_LOG_FILE = None

class WebDriver(RemoteWebDriver):

    def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
                 port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT, host=DEFAULT_HOST,
                 log_level=DEFAULT_LOG_LEVEL, log_file=DEFAULT_LOG_FILE):
        self.port = port
        if self.port == 0:
            self.port = utils.free_port()
        self.host = host
        self.log_level = log_level
        self.log_file = log_file

        self.iedriver = Service(executable_path, port=self.port,
             host=self.host, log_level=self.log_level, log_file=self.log_file)

        self.iedriver.start()

        if capabilities is None:
            capabilities = DesiredCapabilities.INTERNETEXPLORER

        RemoteWebDriver.__init__(
            self,
            command_executor='http://localhost:%d' % self.port,
            desired_capabilities=capabilities)
        self._is_remote = False

    def quit(self):
        RemoteWebDriver.quit(self)
        self.iedriver.stop()

Should I change the security level of my other browsers too? Or is there an other way to solve this? Thanks in advance!

Mukesh Takhtani
  • 852
  • 5
  • 15
kame
  • 20,848
  • 33
  • 104
  • 159

4 Answers4

1

Not able to launch IE browser using Selenium2 (Webdriver) with Java

The above should answer your question, you do not need to change the security level of all your other browsers. It's not just enabling protected mode which is your problem, it's that you have the security level different for different zones I imagine i.e. internet/intranet

Community
  • 1
  • 1
shicky
  • 2,076
  • 5
  • 30
  • 44
  • This doesn't work when I set all zones to the same level in the same browser. Also I need a solution for Python. Thank you – kame Jan 28 '16 at 18:31
  • the top answer in that is unrelated to language, as is the solution to your problem, it is entirely to do with your browser settings. Was protected mode enabled/disabled set to the same value in all zones as the error message suggested? I remember some odd behaviour around this when the error was throwing for me, needed to re-open IE and set the values a few times. – shicky Jan 28 '16 at 21:12
  • 1
    The level in all zones were the same but the protected mode enabled/disabled was not equal! I have to ask my admin for changing this. – kame Jan 29 '16 at 07:46
  • hope you're able to get it sorted via the admin in that case, can you accept the answer please? – shicky Feb 01 '16 at 09:57
0

I read that I need IgnoreProtectedModeSettings.

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True

driver = webdriver.Ie(capabilities=caps)
kame
  • 20,848
  • 33
  • 104
  • 159
0

Try adding your URL in the trusted sites of IE browser. This worked for me. I tried all options I found but finally adding the URL to trusted sites worked. Make sure you add the correct URL (I mean https/http, whatever opens in IE manually). Hope this helps.

Sudeepthi
  • 494
  • 4
  • 20
0

Please follow the below steps, which might solve most of your issues. Start from step 1 if your browser has proxy setting else you can start from 3rd step

1.I have enabled the proxy in IE.

2.Set environmental variable no_proxy to 127.0.0.1 before launching the browser(i.e..before starting the execution of testcase) Ex: Set Environmental Variable no_proxy 127.0.0.1

3.Set all the internet zones to same level(medium to high) expect restricted sites Open browser>Tools>Internet Options>Security Tab

4.Enable "Enable Protected mode" in all zones