from selenium. webdriver. support import expected_conditions as EC
页面 title
EC.title_is(str)
判断页面title是否与传入值str完全一致
EC.title_contains(str)
判断页面title是否包含传入值str(大小写敏感)
URL
EC.url_to_be(url)
判断当前url是否与传入url完全一致
EC.url_changes(url)
判断当前url是否与传入url不一致
EC.url_contains(str)
判断当前url是否包含传入值str(大小写敏感)
EC.url_matches(reg)
判断当前url是否匹配传入的正则表达式
元素 -> DOM(不一定显示)
EC.presence_of_element_located(locator)
判断传入的locator(find_element)是否已经加载到DOM中
EC.presence_of_all_elements_located(locator)
判断传入的locator(find_elements)的所有WebElement中至少已经加载一个
元素 -> 页面(显示)
EC.visibility_of(element)
判断传入的WebElement是否已经显示在页面上
EC.visibility_of_element_located(locator)
判断传入的locator是否已经加载并显示在页面上
EC.invisibility_of_element(element)
判断传入的WebElement是否没有显示在页面上,或者没有在DOM中
EC.invisibility_of_element_located(locator)
判断传入的locator是否找不到WebElement,或者没有显示在页面上
EC.visibility_of_any_elements_located(locator)
判断传入的locator的所有WebElement(find_elements)中至少已经加载一个并且已经显示在页面上
EC.visibility_of_all_elements_located()
判断传入的locator的所有WebElement(find_elements)全部加载完并且显示在页面上
文字
EC.text_to_be_present_in_element(locator, str)
判断传入的locator的WebElement.text中是否包含传入值str
EC.text_to_be_present_in_element_value(locator, str)
判断传入的locator的WebElement的get_attribute(‘value’)中是否包含传入值str
状态
EC.staleness_of(element)
判断