我们可以在python selenium webdriver中缩放浏览器窗口吗?

我正在尝试仅使用键盘来放大和缩小Chrome(seleniumwebdriver)。我努力了 -

from selenium.webdriver.common.keys import Keys

driver.find_element_by_tag_name("body").send_keys(Keys.CONTROL,Keys.SUBTRACT).

但它不起作用。需要在python中回答。

回答:

我只是为此而苦苦挣扎。我设法找到了对我有用的东西,希望对您有用:

driver.execute_script("document.body.style.zoom='zoom %'")

拥有’zoom%’=您想要的任何缩放级别。(例如“ 67%”)

以上是 我们可以在python selenium webdriver中缩放浏览器窗口吗? 的全部内容, 来源链接: utcz.com/qa/425773.html

回到顶部