Using WebDriver 3.5.3
along with ChromeDriver 2.31
, I attempted to zoom out on a webpage.
Unfortunately, the following code snippet did not have any effect on the page:
driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
I also tried achieving this through JavaScript
:
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("document.body.style.zoom = '30%';");