后浪云Python教程:python3 selenium如何清空输入框中的内容

使用场景:搜索的时候,我需要清除搜索框中其他的关键词
使用方法:driver.clear()
举例说明:
# 设定搜索内容
search_content = ['java', '测试']
# 定位搜索框的位置
search_key = self.driver.find_element_by_css_selector("input.search-key")
# 清空搜索框中的内容
search_key.clear()
# 搜索
search_key.send_keys(random.choice(self.search_content))更多技术请关注Python视频教程。
版权声明:
作者:后浪云
链接:https://idc.net/help/181801/
文章版权归作者所有,未经允许请勿转载。
THE END
