0

I got this error NoSuchElementException when I run the following script.

driver.find_element("xpath", "//*[@id='lastAttemptYear']").click().send_keys("2022")

The original element has shown below.

<input type="text" size="5" maxlength="4" id="lastAttemptYear" name="lastAttemptYear" onkeyup="moveOnMax(this,'lastAttemptMonth')" value="2022" autocomplete="off">

What should I do? thanks!

Gordon
  • 51
  • 7

1 Answers1

0

I have found the solution here!

I have to do this first!

frame = driver.find_element("xpath", '//frame[@name="main"]')
driver.switch_to.frame(frame)
pass1 = driver.find_element(By.ID, "lastAttemptYear")
Gordon
  • 51
  • 7