[英]Simulate moving mouse outside of webpage area using selenium in python
[英]How to zoomin the webpage using mouse in selenium python or robot framework using selenium library?
我想使用机器人框架 selenium 库测试 web 应用程序的缩放功能。 还想知道是否可以在 python 中使用 selenium webdriver 来完成。
我想放大网页。
为此,我尝试了类似下面的方法
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%'")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.