How to Zoom In and Zoom Out in Website

In case, you want to zoom in and out in any website using Selenium. You can follow below commands:


To Zoom In:

WebElement Sel= driver.findElement(By.tagName("html"));
sel.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));

To Zoom Out to normal page, use below command:

html.sel(Keys.chord(Keys.CONTROL, "0"));

This can be useful when you need to pin point something while showing your automation framework to any user.