python selenium - webdriver wait until css_Selector visible

坚强是说给别人听的谎言 提交于 2019-12-02 12:27:13

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)

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() 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!