如何使用selenium python中的鼠标或使用selenium库的robot框架缩放网页?
我想使用robot framework selenium库测试web应用程序的缩放功能。还想知道是否可以在python中使用SeleniumWebDriver来完成 我想放大网页 为此,我尝试了以下方法如何使用selenium python中的鼠标或使用selenium库的robot框架缩放网页?,python,selenium,robotframework,Python,Selenium,Robotframework,我想使用robot framework selenium库测试web应用程序的缩放功能。还想知道是否可以在python中使用SeleniumWebDriver来完成 我想放大网页 为此,我尝试了以下方法 from selenium.webdriver.common.action_chains import ActionChains ActionChains(driver).move_to_element(canvas_element) .send_keys(Keys.chord(Keys.CO
from selenium.webdriver.common.action_chains import ActionChains
ActionChains(driver).move_to_element(canvas_element)
.send_keys(Keys.chord(Keys.CONTROL, Keys.ADD)).build().perform();
但这给了我下面一个错误
AttributeError: type object 'Keys' has no attribute 'chord'
我怎样才能解决这个问题。有人能帮我吗?谢谢 已编辑 试试这个:
driver.execute_script("document.body.style.zoom='40%'")
然后使用以下选项恢复到正常缩放:
driver.execute_script("document.body.style.zoom='100%'")
如何使用鼠标滚动仅对画布元素执行相同操作。谢谢谢谢。它实际上不会缩放元素或网页……好吧,我必须找到一个解决方案,因为你已经接受了答案,请尝试编辑。