selenium.webdriver.support.expected_conditions(模塊) 這兩個條件類驗證title,驗證傳入的參數title是否等於或包含於driver.title title_is title_contains 這兩我的條件驗證元素是否出現,傳入的參數都是元組類型的locator,如(By.ID, 'kw') 顧名思義,一個只要一個符合條件的元素加載出來就經過;另外一個必須全部符合條件的元素都加載出來才行 presence_of_element_located presence_of_all_elements_located 這三個條件驗證元素是否可見,前兩個傳入參數是元組類型的locator,第三個傳入WebElement 第一個和第三個其實質是同樣的 visibility_of_element_located invisibility_of_element_located visibility_of 這兩我的條件判斷某段文本是否出如今某元素中,一個判斷元素的text,一個判斷元素的value text_to_be_present_in_element text_to_be_present_in_element_value 這個條件判斷frame是否可切入,可傳入locator元組或者直接傳入定位方式:id、name、index或WebElement frame_to_be_available_and_switch_to_it 這個條件判斷是否有alert出現 alert_is_present 這個條件判斷元素是否可點擊,傳入locator element_to_be_clickable 這四個條件判斷元素是否被選中,第一個條件傳入WebElement對象,第二個傳入locator元組 第三個傳入WebElement對象以及狀態,相等返回True,不然返回False 第四個傳入locator以及狀態,相等返回True,不然返回False element_to_be_selected element_located_to_be_selected element_selection_state_to_be element_located_selection_state_to_be 最後一個條件判斷一個元素是否仍在DOM中,傳入WebElement對象,能夠判斷頁面是否刷新了
https://img2018.cnblogs.com/blog/1532113/201901/1532113-20190104221032832-975337577.png)css