How to fill a text box with selenium?

Issue

I tried to fill a text box with my student code 21314423, but when I execute it it throws me this:

DeprecationWarning: use driver.switch_to.frame instead driver.switch_to_frame (driver.find_element_by_xpath ("// frame [@ name = 'Menu']")

This is all code the HTML:

This is the code that I use:

But it doesn't work. How can I fix this?


Solution

I think the below should work for you to switch to frame :

driver.switch_to.default_content()
wait = WebDriverWait(driver, 20)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, "contenido")))
print('yes ! Switched to frame ')
wait.until(EC.element_to_be_clickable((By.NAME, "pCodigoAlumno"))).send_keys('21314423')
print("Number was sent successfully")

Imports :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

Answered By – cruisepandey

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published