I'm running into an issue with Selenium WebDriver in Java, where I can't set the IE browser zoom level to 100% when the user has a different default value. Ctrl + 0 does not work since this sets the zoom to the default. I've tried setting zoom through a JavascriptExecutor, as seen in other posts as well. Any help would be appreciated.
Set zoom level to 100% in Selenium WebDriver when default is not 100
19.9k Views Asked by jonlip AtThere are 5 best solutions below

Try ignoring the zoom level all together.
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
driver = new InternetExplorerDriver(caps);
You can see others with the zoom issue here: Similar issue

From what I googled, you can set the default zoom using the registry. I haven't tried this myself but you should be able to grab the user's default setting, change it to 100% (if it's not there already), do your test, and then restore their default setting.
I haven't tried this myself but it looks pretty straightforward.
HKEY_CURRENT_USERS\SOFTWARE\Microsoft\Internet Explorer\Zoom
Set ZoomFactor to 1000x the factor you want, e.g. 125% is 125000
https://support.microsoft.com/en-us/help/2689447/how-to-set-the-zoom-level-in-internet-explorer-9

Try Below Code, It is working code
InternetExplorerOptions capabilities= new InternetExplorerOptions();
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
System.setProperty("webdriver.ie.driver", Constant.drivers + "\\IEDriverServer.exe");
driver = new InternetExplorerDriver(capabilities);
driver.manage().window().maximize();
Try this, you can tweak the calculation which returns the current zoom level, I may be wrong at that