selenium等待

 1 from selenium import webdriver
 2 from selenium.webdriver.common.by import By
 3 from selenium.webdriver.support.ui import WebDriverWait
 4 from selenium.webdriver.support import expected_conditions as EC
 5 
 6 driver = webdriver.Firefox()
 7 driver.get("http://somedomain/url_that_delay_loading")
 8 try:
 9     element = WebDriverWait(driver,10).until(
10         EC.presence_of_element_located((By.ID,"myDynamicElement"))
11     )
12 finally:
13     driver.quit()

 

 

posted @ 2019-10-09 18:57  银杏叶的学习笔记  阅读(205)  评论(0编辑  收藏  举报