34使用selenium浏览器出现Chrome正受到自动测试软件的控制”和“请停用以开发者模式运行的扩展程序
本人使用就是看着不爽
版本:4.9.0
解决方法
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
driver = webdriver.Chrome(chrome_options=chrome_options)
# @Time : 2023/7/12
# @Author : bgm
# @File : selenium-py.py
# Version: 4.10.0
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
options = webdriver.ChromeOptions()
options.add_argument('headless') # 无头
service = Service()
driver = webdriver.Chrome(service=service, options=options)
# driver.get("https://www.facebook.com/")
driver.get("https://www.baidu.com/")
data = driver.page_source
print(data)
本文来自博客园,作者:__username,转载请注明原文链接:https://www.cnblogs.com/code3/p/16996031.html