Zoom In And Zoom Out In Selenium using JavascriptExecutor:
public void zoomInOut(String value) {
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.body.style.zoom='" + value + "'");
}
And use the above function as per your need like:
public void validateZoom() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://testersdigest.blogspot.com");
zoomInOut("150%");
zoomInOut("10%");
zoomInOut("40%");
}
public void zoomInOut(String value) {
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.body.style.zoom='" + value + "'");
}
And use the above function as per your need like:
public void validateZoom() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://testersdigest.blogspot.com");
zoomInOut("150%");
zoomInOut("10%");
zoomInOut("40%");
}
Comments
Post a Comment