第一步,导库
import time
from selenium.webdriver import Chrome
第二步,使用clear()
使用xpath定位到搜索框,再后面加入.clear()即可
#删除搜索框数据
input_obj = chrome_obj.find_element_by_xpath('//*[@id="J_search_key"]').clear()
#输入搜索框数据
input_obj = chrome_obj.find_element_by_xpath('//*[@id="J_search_key"]').send_keys('秋裤')