Expected conditions in Explicit waits in Selenium

in #selenium7 years ago

Today I bring you how to wait until some element is present in the website you are automatically browsing. Ladies and gentlemen, look at Expected conditions!

What do we have over here?

List of types of Explicit Waits

title_is
title_contains
presence_of_element_located
visibility_of_element_located
visibility_of
presence_of_all_elements_located
text_to_be_present_in_element
text_to_be_present_in_element_value
frame_to_be_available_and_switch_to_it
invisibility_of_element_located
element_to_be_clickable
staleness_of
element_to_be_selected
element_located_to_be_selected
element_selection_state_to_be
element_located_selection_state_to_be
alert_is_present

All of them, we are going to use them as this:

from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
element = wait.until(EC.element_to_be_clickable((By.ID, "the_id")))

Enjoy the party!

Sort:  

Congratulations @userpodcast! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!