Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

OPT value not passing through selenium due to "no such element"

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading