Advertisement
ph4x35ccb

Untitled

Jun 18th, 2023
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.common.keys import Keys
  3. from selenium.webdriver.common.by import By
  4. from selenium.webdriver.chrome.options import Options
  5. import os
  6. import time
  7. import requests
  8.  
  9. ##API
  10. #CHAVE    I28hd85vK62nxP6eU7iBpqYlWm******
  11. agent = {"User-Agent": 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36'}
  12. api = requests.get("https://editacodigo.com.br/index/api-whatsapp/I28hd85vK62nxP6eU7iBp*******" ,  headers=agent)
  13. time.sleep(1)
  14. api = api.text
  15. api = api.split(".n.")
  16. bolinha_notificacao = api[3].strip()
  17. contato_cliente = api[4].strip()
  18. caixa_msg = api[5].strip()
  19. msg_cliente = api[6].strip()
  20. caixa_msg2 = api[7].strip()
  21. caixa_pesquisa = api[8].strip()
  22. ##############################
  23.  
  24. dir_path = os.getcwd()
  25. chrome_options2 = Options()
  26. chrome_options2.add_argument(r"user-data-dir=" +  dir_path + "profile/zap")
  27. driver = webdriver.Chrome(options=chrome_options2);
  28. driver.get('https://web.whatsapp.com')
  29. time.sleep(30)
  30.  
  31. def bot():
  32.     try:
  33.         bolinha = driver.find_element(By.CLASS_NAME,bolinha_notificacao)
  34.         bolinha = driver.find_elements(By.CLASS_NAME,bolinha_notificacao)
  35.         clica_bolinha = bolinha[-1]
  36.         click_bolinha = webdriver.common.action_chains.ActionChains(driver)
  37.         click_bolinha.move_to_element_whit_offset(clica_bolinha,0,-20)
  38.         click_bolinha.click()
  39.         click_bolinha.perform()
  40.         click_bolinha.click()
  41.         click_bolinha.perform()
  42.     except:
  43.         print('OLA')
  44.  
  45. while True:
  46.     bot()
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement