selenium 键盘事件
# 要想使用键盘事件,得导入键盘事件类 from selenium.webdriver.common.keys import Keys from selenium import webdriver import time driver = webdriver.Chrome() driver.get("https://www.baidu.com") ele = driver.find_element_by_id("kw") ele.send_keys("selenium") time.sleep(3) # 退格键 ele.send_keys(Keys.BACK_SPACE) time.sleep(3) # 全选操作 ele.send_keys(Keys.CONTROL,'A') # 剪切操作 ele.send_keys(Keys.CONTROL,'x') time.sleep(3)
世界上最美的风景,是自己努力的模样