是等待頁面元素可見的時候操作,會設置一定范圍的時間,如果在時間范圍內,元素可見,就
執行操作,元素不可見,就會引發TimeoutException的異常。如下是element_to_be_clickable
類的源碼
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get('http://www.baidu.com')
so = WebDriverWait(driver,10).until(expected_conditions.element_to_be_clickable((By.ID,'kwkw')))
so.send_keys('appium')
driver.quit()