from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui
import time
hesaplar = open("hesaplar.txt","r").read().splitlines()
kullanicilar = open("kullanicilar.txt","r").read().splitlines()
browser = webdriver.Chrome()i = 0def dm():
    i = 0  
 for isim in kullanicilar:
        i+=1        
        browser.get("https://www.instagram.com/p/CJ9HhlqH5xJ/")
        time.sleep(5)
        paylas = browser.find_element_by_xpath("//*[@id='react-root']/section/main/div/div[1]/article/div[3]/section[1]/button")
        paylas.click()
        time.sleep(5)
        pyautogui.typewrite(isim)
        time.sleep(5)
        pyautogui.hotkey("tab")
        time.sleep(5)
        pyautogui.press("enter")
        time.sleep(5)
        gonder = browser.find_element_by_xpath("/html/body/div[5]/div/div/div[1]/div/div[2]/div/button")
        gonder.click()
        time.sleep(5)
        browser.get("https://www.instagram.com/direct/inbox/")
        time.sleep(5)
        if i==1:
            bildirim = browser.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]")
            bildirim.click()
            time.sleep(5)
            mesaj1 = browser.find_element_by_xpath("//*[@id='react-root']/section/div/div[2]/div/div/div[1]/div[2]/div/div/div/div/div[1]/a")
            mesaj1.click()
            time.sleep(5)
            pyautogui.typewrite("Kaliteli Şarkılar için takipte kalın :)")
            pyautogui.press('enter')
            time.sleep(4)
            continue
         elif i%15==0:
            mesaj1 = browser.find_element_by_xpath("//*[@id='react-root']/section/div/div[2]/div/div/div[1]/div[2]/div/div/div/div/div[1]/a")
            mesaj1.click()
            time.sleep(5)
            pyautogui.typewrite("Kaliteli Şarkılar için takipte kalın :)")
            pyautogui.press('enter')
            browser.quit()
        else:
            mesaj1 = browser.find_element_by_xpath("//*[@id='react-root']/section/div/div[2]/div/div/div[1]/div[2]/div/div/div/div/div[1]/a")
            mesaj1.click()
            time.sleep(5)
            pyautogui.typewrite("Kaliteli Şarkılar için takipte kalın :)")
            pyautogui.press('enter')
            time.sleep(4)
            continue
 for ad in hesaplar:
    browser.get("https://www.instagram.com")
    time.sleep(5)
    emailInput = browser.find_element_by_xpath("//*[@id='loginForm']/div/div[1]/div/label/input")
    passwordInput = browser.find_element_by_xpath("//*[@id='loginForm']/div/div[2]/div/label/input")
    emailInput.send_keys(ad)
    passwordInput.send_keys("kaf3060907a")
    passwordInput.send_keys(Keys.ENTER)
    time.sleep(5)
    dm()
python hedef maina etkin olarak reddettiğinden bağlantı kurulamadı hatası alıyorum ilk hesaptan 15 dm atıyor ama 2 inci hesaba geçmiyoryardım edebilecek varmı ?