Python+Selenium清除输入文本+刷新浏览器

#coding=utf-8  
  
from selenium import webdriver  
import time 
  
driver = webdriver.Chrome()  
driver.maximize_window()  
driver.implicitly_wait(6)  
  
driver.get("https://www.baidu.com")  
driver.find_element_by_id("kw").send_keys("Selenium")
time.sleep(5)
try:
	driver.find_element_by_id("kw").clear()
	print("Passed:Clear Success")
except Exception as e:
	print("Failed",format(e))

driver.quit()

  

posted @ 2017-10-20 09:52  xiaomogu110  阅读(3195)  评论(0编辑  收藏  举报