[Solved] Python Instagram Auto logger

I have rewrote your code a little bit and it works now:

from selenium import webdriver
from getpass import getpass
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

chromedriver = "C:\\Users\\Utente\\Desktop\\chromedriver"
driver = webdriver.Chrome(chromedriver)

usr = input ("Enter Your Email: ")
psw = getpass("Enter Your Password: ")
prfl = input('Enter the exactly name of the profile you want the picture: ')


wait = WebDriverWait(driver, 5)
wait.until(EC.presence_of_element_located((By.XPATH, '//input[@name="username"]'))).send_keys(usr)
driver.find_element_by_xpath('//button[contains(text(), "Log in")]').click()
wait.until(EC.presence_of_element_located((By.XPATH, '//a[text()="Profile"]')))

I’m using explicit waits to make the code more stable.

Hope, this will help you to learn how selenium works.


solved Python Instagram Auto logger