Selenium Wait For All Class Elements
I'm trying to do a wait in which the driver waits until all the elements of the same class are located. For Example: If class is foo I try: WebDriverWait(driver, 5).until(EC.presen
Solution 1:
WebDriverWait inconjunction with the expected_conditions as presence_of_element_located()
will wait for the very first matched WebElement.
To wait until all the elements of the same class e.g. fooclass are present, instead of presence_of_element_located()
you need to induce WebDriverWait for the presence_of_all_elements_located() and your effective code block will be:
WebDriverWait(driver, 10).until(EC.presence_of_all_elements_located((By.CLASS_NAME, 'foo')))
Note : You have to add the following imports :
from selenium.webdriver.support.uiimportWebDriverWaitfrom selenium.webdriver.common.byimportByfrom selenium.webdriver.supportimport expected_conditions asEC
Post a Comment for "Selenium Wait For All Class Elements"