前言
pywinauto 操作鼠标,滚动查看
鼠标点击操作
单击鼠标左键, coords 参数是点击的坐标位置
from pywinauto import mouse
# 单击鼠标左键
mouse.click(coords=(100,100))
鼠标右击
mouse.right_click(coords=(100,200))
鼠标双击
mouse.double_click(coords=(100,200))
鼠标长按,拖动,释放
mouse.press(coords=(200,400))
mouse.move(coords=(100, 0))
mouse.release(coords=(300,400))
鼠标滚轮操作
mouse.scroll(coords=(0, 0), wheel_dist=1)
鼠标中键单击指定的坐标
mouse.wheel_click(coords=(0, 0))
滚动列表
滚动微信聊天记录列表
from pywinauto import mouse
from pywinauto.application import Application
from pywinauto.keyboard import send_keys
# 连接到wx
app = Application(backend='uia').connect(
path=r'C:\Program Files (x86)\Tencent\WeChat\WeChat.exe'
)
# 定位到主窗口
win = app.window(title="微信", class_name='WeChatMainWndForPC')
# 选择聊天窗口
loc = win.child_window(title="会话", control_type="List").rectangle()
print(loc)
# 滚动聊天窗口
mouse.scroll(coords=(loc.left+20, loc.top+30), wheel_dist=-2)
标签:滚动,鼠标,16,windows,pywinauto,coords,100,mouse
From: https://www.cnblogs.com/yoyoketang/p/17657612.html