Search code examples
pythonseleniumframe

How to click on button which is present in a frame using python selenium webdriver


I want to click on the shaded button but it's inside the frame, which seems to be inside another frame. How can I do it?

enter image description here


Solution

  • To go into nested iframes and then click the button with text Continuar.

    wait = WebDriverWait(driver, 10)
    wait.until(ec.frame_to_be_available_and_switch_to_it((By.XPATH,"//frame[@name='reloj']" )))
    wait.until(ec.frame_to_be_available_and_switch_to_it((By.XPATH,"//frame[@name='transicion']")))
    wait.until(ec.frame_to_be_available_and_switch_to_it((By.XPATH,"//button[text()='Continuar']"))).click()
    

    Import

    from selenium.webdriver.support import expected_conditions as ec
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By