I am automating a web application in ME-Edge in IE Mode on Windows 11. I have to set zoom level to 80% for same requirement for all end to end test cases. I tried with multiple given code // To zoom out 3 times
for(int i=0; i<3; i++){
driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL,Keys.SUBTRACT));
}
Also tried with JavascriptExecutor, but its working for launching page, once logged in and it goes to next page where browser zoom will be 100% again and execution stops.
JavascriptExecutor jse = (JavascriptExecutor)driver;
Thread.sleep(3000);
System.out.println("Zoom with 80%");
jse.executeScript("document.body.style.zoom='80%'");
Also, tried with press CTRL+SUBTRACT but script stops further execution.
System.setProperty("webdriver.ie.driver",
FileReaderManager.getInstance().getConfigReader().getDriverPath()
+ "\\IEDriverServer32bit.exe");
InternetExplorerOptions edgeIe11Options = new InternetExplorerOptions();
Map<String, Object> ops = (Map<String, Object>) edgeIe11Options.getCapability("se:ieOptions");
ops.put("ie.edgechromium", true);
ops.put("ie.edgepath", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"); edgeIe11Options.introduceFlakinessByIgnoringSecurityDomains();
edgeIe11Options.ignoreZoomSettings();
edgeIe11Options.enablePersistentHovering();
edgeIe11Options.getBrowserName();
edgeIe11Options.takeFullPageScreenshot();
// edgeIe11Options.disableNativeEvents();
edgeIe11Options.requireWindowFocus();
edgeIe11Options.destructivelyEnsureCleanSession();
edgeIe11Options.setCapability("ignoreProtectedModeSettings", true);
edgeIe11Options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.IGNORE);
driver = new InternetExplorerDriver(edgeIe11Options);