Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro nos cliques no instagram #5

Open
lepokoloko opened this issue Feb 2, 2023 · 2 comments
Open

Erro nos cliques no instagram #5

lepokoloko opened this issue Feb 2, 2023 · 2 comments

Comments

@lepokoloko
Copy link

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
Copy link
Author

`#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
Copy link

estou com o mesmo problema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants