读取浏览器的配置就好
from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_argument("headless")
driver = webdriver.Chrome(chrome_options=option)
# driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
print(driver.title)
driver.maximize_window() # 窗口最大化
# 定位输入框
input_tag = driver.find_element_by_id('kw')
# 模拟键盘输入关键字
input_tag.send_keys("妹子图")
# 键盘操作
input_tag.send_keys(Keys.ENTER)
driver.quit()