title: Python Selenium Webscrapping - While log in wrong password Error
body: <p>Even though my password is <strong>correct</strong>. I can't log in to Instagram and it gives your password is incorrect error. My intention is to enter Instagram and follow some users automatically. However, I am totally stuck at the login screen. Can the language and connection country be a problem?</p>
  <pre><code>from selenium import webdriver    
  from selenium.webdriver.common.by import By as by    
  from time import sleep    
  from selenium.webdriver.common.keys import Keys    
  
       
      URL = &quot;https://www.instagram.com/natgeo/&quot;
      URL_LOGIN = &quot;https://www.instagram.com/accounts/login/&quot;
      USERNAME = &quot;id&quot;
      PASSWORD = 'pass'
       
  
   
  
      class InstaFollower:
          def __init__(self):
              self.driver = webdriver.Chrome(&quot;C:\Selenium\chromedriver.exe&quot;)
  
   
      def login(self):
          self.driver.get(URL_LOGIN)
          sleep(3)
          self.driver.find_element(by.XPATH, '/html/body/div[4]/div/div/button[1]').click()
          sleep(5)
          for x in USERNAME:
              self.driver.find_element(by.CSS_SELECTOR,
                                       'input[aria-label=&quot;Telefon numarası, kullanıcı adı veya e-posta&quot;]').send_keys(x)
              sleep(.3)
          sleep(5)
          self.driver.find_element(by.CSS_SELECTOR, 'input[aria-label=&quot;Şifre&quot;]').clear()
          passy = self.driver.find_element(by.CSS_SELECTOR, 'input[aria-label=&quot;Şifre&quot;]')
          for i in PASSWORD:
              passy.send_keys(i)
              sleep(.3)
          sleep(5)
          passy.send_keys(Keys.ENTER)
   
          sleep(5)
          self.driver.find_element(by.CSS_SELECTOR, 'button[class=&quot;sqdOP  L3NKy   y3zKF     &quot;]').click()
          sleep(5)
          self.driver.find_element(by.CSS_SELECTOR, 'button[class=&quot;aOOlW   HoLwm &quot;]').click()
          sleep(5)
          self.driver.get(URL)
   
      def find_followers(self):
          self.driver.find_element(by.CSS_SELECTOR, 'a[class=&quot;-nal3 &quot;]').click()
          followers = self.driver.find_elements(by.CSS_SELECTOR, 'button[class=&quot;sqdOP  L3NKy   y3zKF     &quot;]')
          print(followers)
          return followers
   
      def follow(self, followers):
          for follower in followers:
              follower.click()
              print(&quot;Followed!&quot;)
          self.driver.find_element(by.CSS_SELECTOR, 'button[class=&quot;wpO6b  &quot;]').click()
   
   
  bot = InstaFollower()
  bot.login()
  followers = bot.find_followers()
  bot.follow(followers)
  </code></pre>
  <p>My Solution:
  Password correction was done and after that, I changed the user following algorithm and in the end, it works perfectly but still, there is an improvement chance in which I can follow more people at once. I am going to try to do it in a simple way again but currently have no idea about it. :)
  from selenium import webdriver<br />
  from selenium.webdriver.common.by import By as by<br />
  from time import sleep<br />
  from selenium.webdriver.common.keys import Keys</p>
  <pre><code>    URL = &quot;https://www.instagram.com/natgeo/&quot;
      URL_LOGIN = &quot;https://www.instagram.com/accounts/login/&quot;
      USERNAME = &quot;id&quot;
      PASSWORD = 'pass'
  
  
  class InstaFollower:
      def __init__(self):
          self.driver = webdriver.Chrome(executable_path=&quot;C:\Selenium\chromedriver.exe&quot;)
  
      def login(self):
          self.driver.get(&quot;https://www.instagram.com/accounts/login/&quot;)
          sleep(5)
          self.driver.find_element(by.XPATH, '/html/body/div[4]/div/div/button[1]').click()
          usr = self.driver.find_element(by.CSS_SELECTOR,
                                         'input[aria-label=&quot;Telefon numarası, kullanıcı adı veya e-posta&quot;]')
          for x in USERNAME:
              usr.send_keys(x)
              sleep(.1)
          sleep(2)
          passy = self.driver.find_element(by.CSS_SELECTOR, 'input[aria-label=&quot;Şifre&quot;]')
          for i in PASSWORD:
              passy.send_keys(i)
              sleep(.1)
          passy.send_keys(Keys.ENTER)
          sleep(5)
          self.driver.find_element(by.CSS_SELECTOR, 'div.cmbtv').click()
          sleep(5)
          self.driver.find_element(by.CSS_SELECTOR, 'button.HoLwm').click()
  
      def find_followers(self):
          self.driver.get(URL)
          self.driver.find_element(by.CSS_SELECTOR, 'a.-nal3').click()
  
      def follow(self):
          x=0
          sleep(5)
          follower_screen=self.driver.find_elements(by.CSS_SELECTOR,'button.sqdOP.L3NKy.y3zKF')
          for f in follower_screen:
              f.click()
              try:
                  self.driver.find_element(by.CSS_SELECTOR,'button.aOOlW.HoLwm').click()
              except:
                  pass
              print(&quot;Followed!&quot;)
              sleep(.7)
  
  bot = InstaFollower()
  bot.login()
  followers = bot.find_followers()
  bot.follow()
  </code></pre>