Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 897
ChanChow Avatar asked Dec 04 '22 23:12

ChanChow


2 Answers

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());
like image 27
Miroslav Mikolaj Avatar answered Dec 06 '22 19:12

Miroslav Mikolaj


DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
aDriver = new InternetExplorerDriver(caps);

Fixed the issue.

like image 83
ChanChow Avatar answered Dec 06 '22 18:12

ChanChow