请帮助我了解Selenium中的正确代码,我可以在chrome浏览器中设置67%的放大,然后单击下一步按钮。!
使用以下示例代码
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");
如注释中所述0.67
表示67%
,1.00
表示100%
缩放等