Why can’t I fill out this field?

so I use Python Selenium Webdriver and I am stuck at filling out that credit card field… I tried many things but nothing worked… This is my actual code, but it doesn’t work.

How can I fill it out? (Console)<—— Console insight

inputCC = WebDriverWait(driver, 30).until(
                lambda driver: driver.find_element_by_id("encryptedCardNumber")
            )
            inputCC.send_keys("1111222233334444")

Console

Answer

If you look at the bottom of that HTML you will see that input tag is within an </iframe>. You need to switch to that first. I can’t see the iFrame details but something like this….

iframe = driver.find_element_by_xpath("//iframe[@name='xyz']")

driver.switch_to.frame(iframe)

Obviously fill out the Xpath with the correct information above

Then your code…

inputCC = WebDriverWait(driver, 30).until(
                lambda driver: driver.find_element_by_id("encryptedCardNumber")
            )
            inputCC.send_keys("1111222233334444")

Then to switch back to the default content…

driver.switch_to.default_content()