O'Reilly logo

Learning Selenium Testing Tools with Python by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The expected condition class

The following table shows some common conditions along with examples that we frequently come across when automating web browsers supported by the expected_conditions class:

Expected condition

Description

Argument

Example

element_to_be_clickable(locator)

This will wait for an element to be located and be visible and enabled so that it can be clicked.

This method returns the element that is located back to the test.

locator: This is a tuple of (by, locator).

WebDriverWait(self.driver, 10).until(expected_conditions.element_to_be_clickable((By.NAME,"is_subscribed")))

element_to_be_selected(element)

This will wait until a specified element is selected.

element: This is the WebElement.

subscription = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required