I’m trying to pass an OPT code using selenium, python but it does not work on this specific window; same with the "CONFIRM" button because It does not find the element. The ID’s as shown on the screen shot is optValue and submitBtn. I tried :
myVerificationCode = wd.find_element(By.ID, 'optValue')
But the following does not find my element. picture
I want the element to be found by wd.find_element so I can pass my opt code value and click confirm next
>Solution :
You have to switch into the iframe (https://www.selenium.dev/documentation/webdriver/interactions/frames/)
Change "driver" variable for "wd" if thats your driver
iframe = driver.find_element(By.XPATH, "//iframe")
driver.switch_to.frame(iframe)
and now you should be able to
myVerificationCode = wd.find_element(By.ID, 'optValue')