1
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?

2 Answers 2

8

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)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks buddy that helped !
0

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() 

4 Comments

This doesn't really answer the question, does it?
He is just a beginner ad I think not to confuse him by giving a bit complex solution. I know the pain of beginner's
I am on 99 rep, please upvote, i just want to hit 100 rep. :(
My point is that your solution isn't complete and doesn't answer the question. It's better to give him a solution that works and maybe he has to study it to understand it but an incomplete solution helps no one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.