第一步 标定坐标
import pyautogui
import time
# 自动防故障功能
pyautogui.FAILSAFE =False
# 停顿功能
pyautogui.PAUSE = 2
# 屏幕总参数获取
width,height = pyautogui.size()
print(width,height) # 1366 768
# 屏幕位置获取
time.sleep(2)
print(pyautogui.position()) # 得到当前鼠标位置
"""
位置参数:
总人数:100,420
导出列表:250,105
发送邮箱:480,405
请输入邮箱:175,330
确定:447,417
再次确定:447,417
返回:37,50
日期总选择:348,132
x方向间距:△x = 66.7
y方向间距:△y = 40
日期选择2021-02-20:540,400
"""
第二步 导出数据
import pyautogui
import time
# 自动防故障功能
pyautogui.FAILSAFE =False
# 停顿功能
pyautogui.PAUSE = 2
# 屏幕总参数获取
width, height = pyautogui.size()
print(width, height) # 1366 768
# 循环操作
def Bacia():
pyautogui.click(85, 413, button='left') # 单击总人数
pyautogui.click(230, 117, button='left') # 单击导出列表
pyautogui.click(473, 405, button='left') # 单击发送邮箱
pyautogui.click(221, 336, button='left') # 选中输入邮箱框
pyautogui.typewrite('*****@163.com', 0.1) # 输入邮箱地址
pyautogui.press('enter') # 按下回车键入.com
pyautogui.click(447, 417, button='left') # 点击确定
time.sleep(1)
pyautogui.click(447, 417, button='left') # 二次确定
pyautogui.click(37, 50, button='left') # 返回
time.sleep(6)
# main函数
Pos_y = 400
P_x = 540
dx = 67
for Pos_x in range(135, 550):
P_x = P_x-dx
Pos_x = P_x
pyautogui.click(348, 132, button='left') # 选择日期
pyautogui.click(Pos_x, Pos_y, button='left') # 选择具体日期
time.sleep(2)
pyautogui.click(516, 536, button='left') # 点击确定按钮
Bacia()
if Pos_x <140:
break