Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用selenium python中的鼠标或使用selenium库的robot框架缩放网页?_Python_Selenium_Robotframework - Fatal编程技术网

如何使用selenium python中的鼠标或使用selenium库的robot框架缩放网页?

如何使用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

我想使用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.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%'")

如何使用鼠标滚动仅对画布元素执行相同操作。谢谢谢谢。它实际上不会缩放元素或网页……好吧,我必须找到一个解决方案,因为你已经接受了答案,请尝试编辑。