from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--auto-open-devtools-for-tabs")
driver = webdriver.Chrome(chrome_options=options)
driver.maximize_window()
只有这种方法才能打开开发者模式,在这之前尝试用过
action = ActionChains(driver)
action.send_keys(Keys.F12).perform()
或者selenium下面的Keys模块,都不能实现