selenium输入框中输入内容再自动点击回车
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('https://www.google.com')
# 定位输入框
input_box = browser.find_element("id", 'APjFqb')
# 输入关键词:selenium
input_box.send_keys('美容')
# 模拟回车操作
try:
input_box.submit()
print('成功回车')
time.sleep(10)
page = browser.page_source
print(page)
except Exception as e:
print(e)
print('fail')