title: Unable to locate element by xpath using Selenium with Python
body: <p>I am creating a Selenium bot in Python. The driver is supposed to open instagram.com and fill in the login form using the users credentials as an input. There is an error:</p>
  <pre><code># FIRST I OPEN INSTAGRAM LIKE THIS
  self.driver.get(&quot;https://www.instagram.com/&quot;)
  
  # THEN A POP-UP APPEARS, AND I CLOSE IT BY CLICKING IN THE ACCEPT BUTTON,
  # IT SEEMS LIKE IT IS NOT AN IFRAME SO NO FRAME SWITCHES ARE NEEDED
  cooki = self.driver.find_element_by_xpath('/html/body/div[2]/div/div/div/div[2]/button[1]')
  cooki.click() 
   
  # NOW I TRY TO FIND THE USERNAME FORM TO WRITE IN AN INPUT
  usbar = self.driver.find_element_by_xpath('//*[@id=&quot;loginForm&quot;]/div/div[1]')    # ERROR HERE
  usbar.send_keys(input('Username: '))
  </code></pre>
  <p>The error says:</p>
  <p>NoSuchElementException: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//*[@id=&quot;loginForm&quot;]/div/div[1]&quot;}</p>
  <p>It cannot find the Username form to write in it. I believe there are no iframes in the way, I don't know if there is any other issue preventing the driver to find it. I am fairly new so I can't upload an image of the html of the page yet, that's why I include the line that opens the page. Can anyone come up with a foolproof solution?</p>