I’m following the documentation on the Selenium website for how to wait for Ajax responses before proceeding, and while the correct dynamically loaded information is found, a timeout error is still thrown.
What my code should do is load a website, wait until dynamically populated elements of a specific class appears, and get the attribute of the classes.
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, "insert-class-name-here"))
)
finally:
html_input = driver.page_source
soup = BeautifulSoup(html_input, features="html.parser")
for each_item in soup.findAll(class_='insert-class-name-here'):
result = each_item['attribute']
print(result)
driver.quit()
The print statements are executing, but I’m still getting a timeout error. I’m not sure how to proceed without putting all the other code I want in the finally
part.