B
B
bfesiuk2020-10-05 17:33:10
Python
bfesiuk, 2020-10-05 17:33:10

Selenium can't find element?

Good day to all!

There is an input in which you need to enter data, but I get the following error:


selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="loginForm"]"}


The input itself:
<input aria-label="Номер телефона, имя пользователя или эл. адрес" aria-required="true" autocapitalize="off" autocorrect="off" maxlength="75" name="username" type="text" class="_2hvTZ pexuQ zyHYP" value="">


My code:
from selenium import webdriver

# init webdriver
driver = webdriver.Chrome('chromedriver')

# connect to instagram
driver.get('https://www.instagram.com/accounts/login/')

# find and select login form
login_form = driver.find_element_by_id('loginForm')
driver.switch_to.frame(login_form)

# input login
driver.find_element_by_name('username').send_keys('abcd')


What could be the problem? Thanks in advance, all the best)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-10-05
@bfesiuk

That's right, where did you get the loginForm from ? You don't have it in the element

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question