from selenium.webdriver.support import expected_conditions as EC 解析


from selenium.webdriver.support import expected_conditions as EC 解析

expected_conditionsSelenium的一個模selenium.webdriver.support.expected_conditions,可以對網頁上元素是否存在,可點擊等等進行判斷,一般用於斷言或與WebDriverWait配合使用。

例如

from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


wait = WebDriverWait(self.driver,20)
wait.until(EC.presence_of_element_located((By.XPATH,'//div[@id="root"]')))#等到啥時候為止


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM