Selenium: Unexpected error launching IE. Browser zoom level was set to 122%. It should be set to 100%
Asked Answered
O

5

5

I am trying to launch IE11 browser on my local machine using the following code.

try{System.setProperty("webdriver.ie.driver", "src/main/resources/bin/IEDriverServer.exe");
            }
            catch (Exception ex){
                Reporter.log("\nException in getting and setting the webdriver IE driver: "+ ex.getMessage() + ex.getClass(),true);
                ex.printStackTrace();
            }
            WebDriverManager.browser = browser;
            driver = new EventFiringWebDriver(new InternetExplorerDriver());
            driver.manage().deleteAllCookies();
            driver.manage().window().maximize();

When I run the code, it brings up the browser with http://localhost:22414/ and fails to load there after. Attaching the logs below.

org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 125%. It should be set to 100% (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.16 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'AAAAAA', ip: '123.123.123.123', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_79'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver

I manually tried setting the browser zoom level to 100%. Even then the error appears.

Ouabain answered 19/9, 2016 at 1:10 Comment(0)
T
1

It may be fixing you the issue, however this could bring you troubles on the long run. Otherwise you may have issues with the native mouse events not identifying the coordinates correctly.

Best way to fix this would be to actually go to the IE browser and set the zoom level the default value, 100%, by going to Settings -> Zoom.

And if you're at it, also make sure that:

  • 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".
  • 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 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. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

You can find more details on the IE Driver github project page.

Terwilliger answered 19/9, 2016 at 5:11 Comment(0)
O
6
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
aDriver = new InternetExplorerDriver(caps);

Fixed the issue.

Ouabain answered 19/9, 2016 at 1:31 Comment(1)
Works for me. Thanks.Thorpe
E
5

This is working fine for me. Ingore that zoom level.

private static InternetExplorerOptions IeSettings()
        {
            var options = new InternetExplorerOptions();
            options.IgnoreZoomLevel = true;
            return options;
        }

public static IWebDriver ieDriver = new InternetExplorerDriver(IeSettings());
Ermin answered 25/2, 2019 at 13:10 Comment(0)
N
4

DesiredCapabilities has been deprecated. The official way to do this now is to use InternetExplorerOptions. When adding these two lines, be sure that you are passing it as an argument when instantiating the driver.

InternetExplorerOptions capabilities = new InternetExplorerOptions();
capabilities.ignoreZoomSettings();
driver = new InternetExplorerDriver(capabilities);
Nonprofessional answered 9/9, 2019 at 14:37 Comment(0)
T
1

It may be fixing you the issue, however this could bring you troubles on the long run. Otherwise you may have issues with the native mouse events not identifying the coordinates correctly.

Best way to fix this would be to actually go to the IE browser and set the zoom level the default value, 100%, by going to Settings -> Zoom.

And if you're at it, also make sure that:

  • 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".
  • 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 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. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

You can find more details on the IE Driver github project page.

Terwilliger answered 19/9, 2016 at 5:11 Comment(0)
M
0
System.setProperty("webdriver.ie.driver",".\\browserDrivers\\IEDriverServer.exe");

DesiredCapabilities capability = DesiredCapabilities.internetExplorer();

capability.setCapability("ignoreZoomSetting", true);
                 capability.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "");

driver = new InternetExplorerDriver(capability);
Menashem answered 12/6, 2018 at 9:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.