from selenium import webdriver from selenium.webdriver.common.keys import Keys option=webdriver.ChromeOptions() option.add_argument(‘--start-maximized‘) drive=webdriver.Chrome(options=option) drive.get(‘http://www.baidu.com‘) className = drive.find_element_by_class_name(‘s_ipt‘)#使用class="s_ipt"定位 className.send_keys(‘周杰伦‘) #输入周杰伦 className.send_keys(Keys.ENTER)#注意Keys,K是大写 drive.quit()