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()
奋起直追的小蘑菇