D
D
Davidd20082021-06-07 07:23:20
Python
Davidd2008, 2021-06-07 07:23:20

What to do if it does not find a field by name in selenium?

here is the code:

from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select 

driver=Chrome()
driver.set_window_size(900,900)
url='https://vk.com/'
driver.get(url)

driver.switch_to.frame(driver.find_element_by_tag_name('iframe'))
a1=driver.find_element_by_name("email")
a1.send_keys('a')

why is it giving an error???? :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kotar4ik, 2021-06-07
@David2008

Good evening.
For some reason, it gives out It's
element not interactable
also interesting why. Through id everything works fine

url='https://vk.com/'
driver.get(url)


elem = driver.find_element_by_id("index_email")
elem.send_keys("name")

Use the code above
driver.switch_to.frame(driver.find_element_by_tag_name('iframe'))

Not needed

S
soremix, 2021-06-07
@SoreMix

why is it giving an error????

What?
iframe that lies on the page is empty

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question