Selenium Webdriver in Python- using expected_conditions.element_to_be_clickable with Webelement as parameter

116 Views Asked by At

Currently I am trying to add an explicit wait to a script I am working on in which the WebElement already exists, but may not yet be in a clickable state.

I am trying to use the following syntax:

WebDriverWait(browser, 20).until(expected_conditions.element_to_be_clickable(webelement))

But get a syntax error that says "Expected interable, recieved WebElement"

Am I using incorrect syntax? In selenium python documentation, it states that this function can take either a locator or a WebElement.

Alternatively, is there a different function that can be used to check whether or not an existing element is clickable?

1

There are 1 best solutions below

1
Prophet On

Your code line missing parenthesis.
Instead of WebDriverWait(browser, 20).until(expected_conditions.element_to_be_clickable(webelement)) it should be

WebDriverWait(browser, 20).until((expected_conditions.element_to_be_clickable(webelement)))