text = browser.find_element_by_css_selector('.dbaListing.listing.lastListing > td:nth-child(4) > span').text这就是我想让我的webdriver等待定位/可见的东西。我该怎么做?
发布于 2016-11-20 19:08:40
使用 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)发布于 2016-11-20 20:28:51
将一些等待时间传递给浏览器,直到CSS选择器可见(加载)为止。您还可以隐式传递等待函数或使用
Wait.until() https://stackoverflow.com/questions/40708200
复制相似问题