R
R
r1dddy4sv2021-01-27 23:19:09
Python
r1dddy4sv, 2021-01-27 23:19:09

Selenium working with Iframe in Python?

The situation is this:
there are inputs in the iframe, where I want to insert data
6011c7f853fec153063549.jpeg

in the photo, the iframe itself and all its sub-elements up to the inputs I need, which are in divs, are shown

WebDriverWait(driver, 10, 0.01).until(EC.frame_to_be_available_and_switch_to_it((By.TAG_NAME,'iframe')))

WebDriverWait(driver, 10,).until(EC.visibility_of_element_located((By.ID,"cardName-input")))
driver.find_element_by_id("cardNumber-input").send_keys(cardname)
driver.find_element_by_id("cardExpiry-input").send_keys(cardname)
driver.find_element_by_id("cardCvc-input").send_keys(cardname)
driver.find_element_by_id("new-card-paynow").send_keys(cardname)


mistake:
WebDriverWait(driver, 10,).until(EC.visibility_of_element_located((By.ID,"cardName-input"))
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:


that is, it does not find the element by id, but as you can see in the screenshot, everything is correct
, I have no idea what is wrong, since I seem to have switched to an iframe,

I ask for help
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
r1dddy4sv, 2021-01-28
@r1dddy4sv

it turns out that the site had an iframe in iframe XD
and the code itself is correct, it just had to switch to another frame

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question