CSS定位,打开百度自动搜索红宝石
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()driver.get("https://www.baidu.com")# driver.find_element_by_css_selector("#kw").send_keys("蓝宝石")
driver.find_element_by_css_selector(".s_ipt").send_keys("红宝石")sleep(2)driver.find_element_by_css_selector("#su").click()
# driver.find_element_by_id("su").click()