python - 如何通过提供 x,y 坐标使用 selnium(或任何其他 webdriver)在网站上移动鼠标
问题描述
while True:
cursorx, cursory = pyautogui.position()
body = driver.find_element_by_css_selector("body")
actions.move_to_element_with_offset(body, cursorx, cursory)
如何在没有元素的情况下在网站上自由移动鼠标?(没有我像在后台那样与它交互。它是用 python 编写的,带有 pyautogui 来获取光标的位置。
解决方案
只需将坐标输入到 pyautogui 的 moveTo 方法中:
pyautogui.moveTo(x=1043, y=606)
推荐阅读
- javascript - 使用 fetch API javascript 时无法从数组中获取数据
- javascript - 如何在不重写的情况下将标题添加到不同的页面
- python - 再次调用函数时对列表的更改保持不变(不需要)
- c# - Convert.ChangeType 不接受 Decimal 的“1E-5”科学记数法,如何解决?
- makefile - GNU MakeFile 包括另一个带有 eval 函数的 makefile 简单问题
- r - R:ties.method = random:使用 ties.method = random 排名时如何始终获得相同的随机化
- c# - 如何在 ASP.NET Core 2.1 上的另一个 API 中调用 API
- princexml - 如何使用 PrinceXML 将 div 对齐到 PDF 中页面的底部
- powershell - 通过 Powershell 处理来自 SOAP 请求的错误代码
- javascript - 如何让我的元素占据全屏并禁用滚动?