Skip to content Skip to sidebar Skip to footer

Skip Waiting For A Website Timer Selenium Python

I'm running Selenium in Python ide with geckodriver. The site I'm trying to open has a timer of 30 seconds that after this 30 seconds a button appears and I send a click on it. Wha

Solution 1:

As per your code trial you can remove the time.sleep(30) and induce WebDriverWait for the element to be clickable as follows :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
# lines of code
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.ID, "proceed"))).click()

Note : Configure the WebDriverWait instance with the maximum time limit as per your usecase. The expected_conditions method element_to_be_clickable() will return the WebElement as soon as the element is visible and enabled such that you can click it.

Post a Comment for "Skip Waiting For A Website Timer Selenium Python"