0

I want to click on a popup window but after trying several ways, I obtain a "TimeoutException" error.

This is the code that I'm trying:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@class='modal-footer modal-footer-gallit-postula' and @id='modal_comentarios']"))).click()

And I attach an image of the htmlenter image description here

For further information, the popup is very similar to the one appearing in the url below after clicking on the green button that says "Postular" (to get the exact popup it's necessary to be logged in). https://trabajo.gallito.com.uy/anuncio/vendedor-automotriz-qm995

2 Answers 2

1

The desired element is within a Modal Dialog Box so to click on the clickable element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.modal-footer.modal-footer-gallit-postula > button.btn.btn-primary.btn-color-postula"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='btn btn-primary btn-color-postula' and text()='Aceptar']"))).click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
Sign up to request clarification or add additional context in comments.

Comments

0

You can use time.sleep() to handle this. For context:

    from selenium import...
    import time

    driver.get(url)
    butn = driver.find_element(by=By.XPATH, value='//* 
    [@id="postular"]').click() 
    time.sleep(5)
    driver.find_element(by=By.XPATH, value='____').click()

-I don't have the credentials to login, but this is how i handle modal alerts

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.