Yinghe Chen
Yinghe Chen

Reputation: 7

Python selenium webdriver time exception when using wait until

Website form select is disabled until the previous form has been completed.It takes some time for website to recognize the fill out. I try to use wait.until(EC.element_to_be_clickable((By.ID, "..."))), but it returns me a time exception error. I tried sleep(2), and it works. I am wondering if I can still use wait in this case.

Upvotes: 0

Views: 1735

Answers (1)

kev
kev

Reputation: 58

You question isn't clear. You should show what you have tried/accomplished so far in detail. However, from what I understand I will try to answer you question in general.

To wait for an element to be clickable the correct syntax would be:

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

element = WebDriverWait(driver, 30).until(
EC.element_to_be_clickable((By.ID, "ID_of_the_element")));
element.click();

In this case I have used ID as the element locator. You can use others such as XPATH as well.

Hope the helps.

Upvotes: 1

Related Questions