selenium + pyautogui 实现淘宝自动登录

pip install pyautogui

官网 https://pyautogui.readthedocs.io/en/latest/mouse.html

使用selenium模块打开浏览器,使用pyautogui模拟真人行为

 

获取按钮的坐标  # 这段代码实时获取鼠标的坐标

import pyautogui, sys
print('Press Ctrl-C to quit.')
try:
    while True:
        x, y = pyautogui.position()
        positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
        print(positionStr, end='')
        print('\b' * len(positionStr), end='', flush=True)
except KeyboardInterrupt:
    print('\n')
posted @ 2020-01-20 17:18  clyde_S  阅读(671)  评论(0编辑  收藏  举报