Shubham Srivastava
Shubham Srivastava

Reputation: 9

How to zoom the chrome Browser to 67% and click on the next button.?

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

Answers (1)

Shubham Jain
Shubham Jain

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

Related Questions