from selenium.webdriver.common.keys import Keys
from selenium import webdriver
import time
dr = webdriver.Chrome()
dr.maximize_window()
dr.get('https://www.baidu.com')
st = dr.find_element_by_id('kw')#定位搜索输入框
st.send_keys('seleniumm')
st.send_keys(Keys.BACK_SPACE)#模拟键盘删除
st.send_keys(Keys.SPACE)#键盘空格
st.send_keys('python3')
st.send_keys(Keys.CONTROL,'a')#Ctrl+A
st.send_keys(Keys.CONTROL,'c')#Ctrl+Cst.clear()
time.sleep(2)
st.send_keys(Keys.CONTROL,'v')#Ctrl+V
su = dr.find_element_by_id('su').send_keys(Keys.ENTER)#回车