So I am populating a list of elements and then I am iterating through each element in the list. How do I implement a wait condition to tell the code to wait 15 seconds before failing to find the element? Specifically I want currentprice and title to try and wait until element is visible rather than just hard execute when it hits that line of code.
elements = driver.find_elements_by_css_selector('div.list-wrap div.item-container')
print(len(elements))
for x in range(len(elements)):
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'div.list-wrap div.item-container')))
elements = driver.find_elements_by_css_selector('div.list-wrap div.item-container')
currentprice = elements[x].find_element_by_css_selector('li.price-current').text
title = elements[x].find_element_by_css_selector('a.item-title').text
...
I tried the following but I am getting the error that WebDriverWait is not a method of elements.
elements[x].WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'li.price-current')))