如何用硒填充文本框?



我试图用我的学生代码21314423填充文本框,但是当我执行它时,它会抛出这个:

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

这是HTML的全部代码:

这是我使用的代码:

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

我认为下面应该可以为您切换到框架:

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")

进口:

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

最新更新