Reputation: 4229
text = browser.find_element_by_css_selector('.dbaListing.listing.lastListing > td:nth-child(4) > span').text
This is what I want my webdriver to wait for to be located/visible. How do I do that?
Upvotes: 1
Views: 5350
Reputation: 185
Pass some wating time to browser until the CSS selector is visible(loaded). You can also pass by implicitly wait function or use
Wait.until()
Upvotes: 0
Reputation: 474281
Use WebDriverWait
with the visibility_of_element_located
Expected Condition:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(browser, 10)
element = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".dbaListing.listing.lastListing > td:nth-child(4) > span")))
print(element.text)
Upvotes: 8