Reputation: 9
Kindly help me to know about the correct code in Selenium where i can set the 67% zoom in chrome browser and then click on the next button.!
Upvotes: 0
Views: 434
Reputation: 17553
Use below sample code
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("document.body.style.zoom = '0.67'"); // 67% Zoom
System.out.println("67% zoom done");
Thread.sleep(5000);
executor.executeScript("document.body.style.zoom = '1.00'"); // 100% Zoom
System.out.println("100% zoom done");
As stated in comment 0.67
means 67%
, 1.00
means 100%
zoom and so on
Upvotes: 3