selenium隐藏浏览器界面并防止检测

# 导包
from selenium.webdriver import ChromeOptions
from selenium.webdriver.chrome.options import Options

# 隐藏浏览器界面
chrome_option = Options()
chrome_option.add_argument('--headless')
chrome_option.add_argument('--disable-gpu')
# 防止检测
option = ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
# 导入配置
driver = webdriver.Chrome(executable_path='./chromedriver.exe', chrome_options=chrome_option, options=option)
    原文作者:等会吃个橘子
    原文地址: https://blog.csdn.net/weixin_44090294/article/details/116033273
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞