from selenium.webdriver.support import expected_conditions as EC 解析
from selenium.webdriver.support import expected_conditions as EC 解析
expected_conditions
是Selenium
的一个模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"]')))#等到啥时候为止