click() 鼠标点击动作;

  send_keys()  输入字符串到文本输入框动作;

  clear()  清除文本框动作;

具体代码:

# coding=utf-8

from selenium import webdriver

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!")
try:
    driver.find_element_by_id("kw").clear()
    print('test pass : clean successful')
except Exception as e:
    print("Exception found",format(e))

  

参考文章:https://blog.csdn.net/u011541946/article/details/68927331

相关文章:

  • 2022-02-25
  • 2022-12-23
  • 2022-02-01
  • 2021-07-16
  • 2022-12-23
  • 2022-03-06
  • 2021-09-30
  • 2021-08-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-09-08
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案