from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
#模拟键盘操作
browser = webdriver.Chrome()
browser.get("https://www.baidu.com/")
sleep(1)
input = browser.find_element_by_id("kw")
input.send_keys("selenium")
sleep(1)
input.send_keys(Keys.DOWN)
sleep(1)
input.send_keys(Keys.DOWN)
sleep(1)
input.send_keys(Keys.DOWN)
sleep(1)
input.send_keys(Keys.UP)
sleep(1)
browser.quit()
Python+Selenium--模拟键盘操作
最新推荐文章于 2024-09-13 17:30:22 发布