Selenium: Capability['ignoreZoomSetting'] doesn't work on IE11 with py-selenium 3.8.1

Created on 23 Feb 2018  路  2Comments  路  Source: SeleniumHQ/selenium

Meta -

OS: Windows10

Selenium Version: 3.8.1

Browser: IE11
When I try to run python-selenium on IE11, I got an exception below

selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Browser zoom level was set to 150%. It should be set to 100%

I have set IE capabilities like below

def ie_driver(self):
        ie_driver = r'C:\Users\ZiYingSu\Documents\python\IEDriverServer.exe'
        os.environ['webdriver.ie.driver'] = ie_driver
        cap = DesiredCapabilities.INTERNETEXPLORER
        cap['platform'] = 'WINDOWS'
        cap['browserName'] = 'internet explorer'
        cap['ignoreProtectedModeSettings'] = True
        **cap['ignoreZoomSetting'] = True**
        cap['IntroduceInstabilityByIgnoringProtectedModeSettings'] = True
        cap['requireWindowFocus'] = True
        cap['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
        self.driver = webdriver.Ie(ie_driver ,capabilities=cap)
        return self.driver

I don't get it why this capability['ignoreZoomSetting'] doesn't work ? I don't want to adjust my IE by manually everytime
Thanks

Browser Version: IE11(64-bit)

Expected Behavior -

IE can ignore zoom setting

Actual Behavior -

Got exception on selenium

selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Browser zoom level was set to 150%. It should be set to 100%

C-py D-IE R-awaiting answer

Most helpful comment

It doesn't look to me like you are putting the option in the correct spot. That is an IE option, and needs to be in the se:ieOptions key within capabilities. I don't see how any of those options are taking without being in the right spot.

Try this code instead:

from selenium.webdriver.ie.options import Options

def ie_driver(self):
    ie_driver = r'C:\Users\ZiYingSu\Documents\python\IEDriverServer.exe'
    opts = Options()
    opts.ignore_protected_mode_settings = True
    opts.ignore_zoom_level = True
    opts.require_window_focus = True
    self.driver = webdriver.Ie(ie_driver, ie_options=opts)
    return self.driver

All 2 comments

It doesn't look to me like you are putting the option in the correct spot. That is an IE option, and needs to be in the se:ieOptions key within capabilities. I don't see how any of those options are taking without being in the right spot.

Try this code instead:

from selenium.webdriver.ie.options import Options

def ie_driver(self):
    ie_driver = r'C:\Users\ZiYingSu\Documents\python\IEDriverServer.exe'
    opts = Options()
    opts.ignore_protected_mode_settings = True
    opts.ignore_zoom_level = True
    opts.require_window_focus = True
    self.driver = webdriver.Ie(ie_driver, ie_options=opts)
    return self.driver

Closing as there has been no response from issue creator

Was this page helpful?
0 / 5 - 0 ratings