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()