
先安裝pyautogui:
pip install pyautogui
#coding=utf-8
import pyautogui
from selenium import webdriver
from time import sleep
dr = webdriver.Chrome()
def size():
x=dr.get_window_size()["width"]#獲取當前屏幕的寬
y=dr.get_window_size()["height"]#獲取當前屏幕的高
return (x,y)
#左滑
def left():
sz=size()
x1=int(sz[0]*0.9)
x2=int(sz[0]*1.3)
y1=int(sz[1]*1.2)
pyautogui.click(x1,y1,button='left')
pyautogui.mouseDown()
pyautogui.moveTo(x2,y1,duration=0.25)
pyautogui.mouseUp()
sleep(1)
dr.get("https://shopcs.yunyoute.com/login")
dr.maximize_window()
sleep(2)
left()
