对于我的第一个关于自动化的项目,我正在开发一个机器人,可以在Instagram上找到一个标签,并像每个图片一样迭代它们。机器人可以做上面提到的事情,除了每个图片迭代。我需要帮助解决这个问题。
一世
import pyautogui,time
pyautogui.FAILSAFE = False
pyautogui.moveTo(608, 431,duration=0.1) #Goes moves cursor to search bar
pyautogui.click(608, 43) # clicks on search bar
pyautogui.typewrite("http://instagram.com") #types in web address
pyautogui.typewrite(["enter"]) #activates enter key
pyautogui.moveTo(641, 96,duration=0.1) #moves cursor to instagram search bar
pyautogui.click(641, 96) #clicks on search bar
pyautogui.typewrite("#cats")# types in hashtag
pyautogui.moveTo(652, 225,duration=0.1) #moves cursor to hashtag suggestion
time.sleep(1);pyautogui.click(652, 225)#clicks on hashtag suggestion
#Clicks on picture
pyautogui.moveTo(348, 564,duration=0.1) #moves cursor on picture
time.sleep(1);pyautogui.click() #Clicks on picture
time.sleep(1);pyautogui.moveTo(1170, 451) #moves cursor to the right arrow on picture
for i in range(4): #clicks on pictures by iterating a certain number of times
pyautogui.click(1170, 451)
尝试添加以下内容
for i in range(4):
time.sleep(5)
pyautogui.moveTo(xRes/2, yRes/2, duration=0.5)
pyautogui.doubleClick()
xRes
和yRes
指的是显示器分辨率,并且像双击图像一样。希望能帮助到你