python中的pyautogui库可以操作鼠标
安装:pip install pyautogui
import time
import pyautogui
def click_operation():
"""点击操作"""
for i in range(3):
# 鼠标需要移动到的位置
x, y = 1396, 850
# 将鼠标移动到指定坐标的间隔时间
num_seconds = 2
# 延迟2秒
time.sleep(2)
# duration 鼠标移动时间
# pyautogui.moveTo(x, y, duration=num_seconds)
# 将鼠标移动到指定位置
pyautogui.moveTo(x, y)
# 点击
pyautogui.click()
# 鼠标需要移动到的位置
x, y = 1900, 15
# 延迟2秒
time.sleep(2)
# 将鼠标移动到指定位置
pyautogui.moveTo(x, y)
# 延迟8秒
time.sleep(10)
# 点击
pyautogui.click()
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39