导包代码:
from selenium.webdriver.common.keys import Keys
用法:
driver.find_element("id","kw").send_keys("python",Keys.ENTER) #在百度首页输入文本,模拟按回车键
driver.find_element("id","kw").send_keys(Keys.CONTROL,"v") #在百度首页文本框内,模拟按Ctrl+v
还有很多按键组合,可在keys.py包查看
导包代码:
from selenium.webdriver.common.keys import Keys
用法:
driver.find_element("id","kw").send_keys("python",Keys.ENTER) #在百度首页输入文本,模拟按回车键
driver.find_element("id","kw").send_keys(Keys.CONTROL,"v") #在百度首页文本框内,模拟按Ctrl+v
还有很多按键组合,可在keys.py包查看