DaviMarta / Automatiza-o

186 stars 98 forks source link

Erro nos cliques no instagram #5

Open lepokoloko opened 1 year ago

lepokoloko commented 1 year ago

Boa noite, nao muito bom com github, porem peguei o codigo que faz as funcoes de abrir o instagram, seguir a pessoa e comentar, porem os cliques não estao indo nos lugares corretos, alguem conseguiu rodar essa parte?

At.

lepokoloko commented 1 year ago

`#base - Entrar no Instagram

options = webdriver.ChromeOptions() options.add_experimental_option('excludeSwitches', ['enable-logging']) driver = webdriver.Chrome(options=options)

Abrir o site do Instagram e fazer login

driver.get("https://www.instagram.com/") time.sleep(4) driver.find_element(By.NAME, "username").send_keys("uppermeshinternet")

driver.find_element(By.NAME, "password").send_keys("404154478")

driver.find_element(By.XPATH, '//button[@type="submit"]').click() time.sleep(5) try: driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/div/div/div/div/button').click() time.sleep(5) except: pass driver.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[2]/div/div/div[1]/div/div[2]/div/div/div/div/div[2]/div/div/div[3]/button[2]').click() time.sleep(3) print("bora bora") for j in range(len(insta_message)): print(j) try: driver.get(insta_message[j]) time.sleep(3) except: #terminar essa parte location = pyautogui.locateOnScreen("reload.png", grayscale=False, confidence=.7) pyautogui.moveTo(location) pyautogui.moveRel(80, 0) pyautogui.click()

add control a in other way

    pyautogui.hotkey('delete')
    time.sleep(1)
    pyautogui.typewrite(insta_message[j])
    pyautogui.hotkey("enter")
    time.sleep(4)       
try:
    try:
        locationn = pyautogui.locateOnScreen("follow.png", grayscale=False, confidence=.7)
        pyautogui.moveTo(locationn)
        pyautogui.moveRel(80, 0)
        pyautogui.click()
        time.sleep(1)
    except:
        pass
    try:
        location2 = pyautogui.locateOnScreen("message.png", grayscale=False, confidence=.7)
        pyautogui.moveTo(location2)
        pyautogui.click()
        time.sleep(5)
        try:
            # mensagem personalizada para cada loja
            name = re.search(r'\/([a-zA-Z0-9_]+)\/?$', insta_message[j])
            if name:
                name = name.group(1)
            name = "Ola, " + str(name) + ", " + "Bom dia!"
        except:
            name = "Ola, "+ "Bom dia!"

        #find first the local for click and type
        pyautogui.typewrite(name)
        #pyautogui.hotkey('enter')
        time.sleep(2)
    except:
        pass

except:
    print("erro", j)
    pass`

Não sei se tem algo errado nesse trecho, iniciando com python

Pedromone commented 1 year ago

estou com o mesmo problema