正常情况下在浏览器控制台输window.navigator.webdriver会返回false,而通过selenium来操作浏览器的情况下会返回true。
可以在程序中,怼入
from selenium.webdriver import Edge
from selenium.webdriver.edge.options import Options
#看下面
edge_options = Options()
#使用chromium内核,打开开发者模式
edge_options.use_chromium = True
#添加参数
edge_options.add_argument('--disable-blink-features=AutomationControlled')
#将参数配置到web对象
web = Edge(options=edge_options)
登录12306铁路网络
...
web.get("https://www.12306.cn/index/")
按F2,在控制台输入window.navigator.webdriver
返回false
![](https://i-blog.csdnimg.cn/blog_migrate/f2e364e3cd7b24d205cb757dc36da19e.png)
完事!!!