1

I'm making basic script for sing-in into Instagram. I faced with this error

enter image description here

Code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

browser = webdriver.Firefox()
browser.get('https://www.instagram.com/accounts/login/')

username = browser.find_element_by_name("username").send_keys('login')
2
  • so the error is it can't locate the browser? Commented Feb 9, 2017 at 23:12
  • @becixb it open the browser and going to url, but it stops when need to enter login to input Commented Feb 10, 2017 at 8:49

2 Answers 2

1

Try to add

time.sleep(5)

before

username = browser.find_element_by_name("username").send_keys('login')

Might be page not fully loaded

Sign up to request clarification or add additional context in comments.

Comments

0

The error reads 'Window not found. The browser window may have been closed'. It happened in line browser.find_element_by_tag_name("body"). The Instagram login page has two such elements, and you need only one of them. You should make the query more specific, for instance by making it return only the first element with the tag.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.