爬虫selenium+edge屋头浏览器+规避检测风险

from selenium import webdriver
from msedge.selenium_tools import EdgeOptions
from msedge.selenium_tools import Edge

edge_options = EdgeOptions()
edge_options.use_chromium = True
# 设置*面模式,也可以添加其它设置
edge_options.add_argument('headless')
#规避被检测到的风险
edge_options.add_experimental_option("excludeSwitches", ["enable-automation"])


driver = Edge(options=edge_options)
r = driver.get('https://www.baidu.com')
print(driver.page_source)
driver.quit()

上一篇:Java源码阅读-Thread


下一篇:selenium--“PO+关键字“教你速成简单的自动化测试框架