text = browser.find_element_by_css_selector('.dbaListing.listing.lastListing > td:nth-child(4) > span').text
这就是我想让我的webdriver等待被定位/可见。 我该怎么做?python selenium - webdriver等到css_Selector可见
text = browser.find_element_by_css_selector('.dbaListing.listing.lastListing > td:nth-child(4) > span').text
这就是我想让我的webdriver等待被定位/可见。 我该怎么做?python selenium - webdriver等到css_Selector可见
使用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)
通过一些瓦亭的时间到浏览器,直到CSS选择器是可见的(加载)。你也可以通过隐式等待功能或使用
Wait.until()
这并不能真正回答这个问题吗? – JeffC
他只是一个初学者广告,我认为不要通过提供一些复杂的解决方案来混淆他。我知道初学者的痛苦 –
我在99代表,请注意,我只想打100代表。 :( –
感谢帮助哥们! –