我为 java 找到了这个:-
WebElement html = driver.findElement(By.tagName("html"));
html.sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD));
但是如何使用 Python 做到这一点呢?我想在收到请求后缩小一级。
请您参考如下方法:
这为使用 selenium (-v 3.141.0) 的 Python 完成了工作
driver = webdriver.Chrome(executable_path='...')
driver.get("www.stackoverflow.com")
driver.execute_script("document.body.style.zoom='50%'")
