代码拉取完成,页面将自动刷新
import pyautogui
import time
import pyperclip
def clickpng(img,t):
times = t
try:
# 1:左单击;2:左双击;3:右单击;4:无限左单击
if times == 1:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.click(location)
elif times == 2:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.doubleClick(location)
time.sleep(1)
elif times == 3:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.doubleClick(location)
elif times == 4:
while True:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.click(location)
time.sleep(0.3)
else:
print('参数有误!')
except:
print("图片有问题")
if __name__ == '__main__':
key = input("请选择运行模式(1:单次运行;2.无线循环):")
print(key)
if key == '1':
print('凯牌RPA开始执行...')
time.sleep(5)
clickpng("chrome.png", 2)
clickpng('baidu.png', 1)
pyperclip.copy("国王排名")
pyautogui.hotkey("ctrl", "v")
pyautogui.hotkey("enter")
time.sleep(2)
clickpng("tupian.png", 1)
time.sleep(2)
pyautogui.screenshot('my.png')
time.sleep(1)
clickpng("quit.png",1)
print("凯牌RPA执行完毕!")
elif key == '2':
while True:
time.sleep(3)
clickpng("chrome.png", 2)
clickpng('baidu.png', 1)
pyperclip.copy("国王排名")
pyautogui.hotkey("ctrl", "v")
pyautogui.hotkey("enter")
time.sleep(2)
clickpng("tupian.png", 1)
time.sleep(2)
pyautogui.screenshot('my.png')
time.sleep(1)
clickpng("quit.png", 1)
print("凯牌RPA执行完毕!")
else:
print("请正确输入!")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。