- 键盘操作需要导入
from selenium.webdriver.common.keys import Keys
ele = driver.find_element(By.ID,"kw") ele.send_keys(Keys.BACK_SPACE)
函数 | 说明 |
---|---|
Keys.BACKSPACE | 退格键 |
Keys.TAB | Tab键 |
Keys.ENTER | 回车键 |
Keys.COMMAND | command键 |
Keys.SHIFT | Shift键 |
Keys.ALT | Alt键 |
Keys.ESCAPE | esc键 |
更多相关操作可以直接去Keys源码中查看
标签:keys,键盘,Keys,模拟,操作,退格 From: https://www.cnblogs.com/py-zhq/p/16749461.html