python selenium - webdriver等到css_Selector可见 [英] python selenium - webdriver wait until css_Selector visible
本文介绍了python selenium - webdriver等到css_Selector可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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?
推荐答案
使用 WebDriverWait
和 visibility_of_element_located
预期条件:
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)
这篇关于python selenium - webdriver等到css_Selector可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文