Set zoom level to 100% in Selenium WebDriver when default is not 100

jonlip picture jonlip · Jul 28, 2017 · Viewed 13.8k times · Source

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.

Answer

Josh Adams picture Josh Adams · Jul 28, 2017

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