Sebastian Nielsen Sebastian Nielsen - 1 year ago 179
Python Question

python selenium - webdriver wait until css_Selector visible

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?

I am new to selenium, so this might be a very newbie question, but I gotta start somewhere. Please dont h8.

Thanks in advance for the help

Answer Source

Use WebDriverWait with the visibility_of_element_located Expected Condition:

from import By
from import WebDriverWait
from 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")))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download