selenium防止chrome自动关闭

 

import requests
import selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
option = webdriver.ChromeOptions()
option.add_experimental_option('useAutomationExtension', False)
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=option)
driver.get(url1)
posted @ 2022-04-01 17:05  CrossPython  阅读(449)  评论(0编辑  收藏  举报