去除自动化特征

✅ 现象说明

这是 百度风控:Selenium自动化特征被识别,触发滑块验证码

浏览器顶部提示:Microsoft Edge 正由自动测试软件控制,这就是自动化标志性特征,百度检测到后弹出安全验证。

方案:去除自动化特征(重点学习,基础反检测)

启动浏览器时添加参数,隐藏 自动化受控提示,降低被识别概率

python 复制代码
from selenium import webdriver
from selenium.webdriver.edge.service import Service
from selenium.webdriver.edge.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

# 1. 配置Edge启动参数,隐藏自动化特征
edge_options = Options()
# 关闭自动化提示框
edge_options.add_experimental_option("useAutomationExtension", False)
edge_options.add_experimental_option("excludeSwitches", ["enable-automation"])

web_driver = webdriver.Edge(
    service=Service(executable_path=r"D:\Software\edgedriver_win64\msedgedriver.exe"),
    options=edge_options
)
# 执行cdp命令,进一步隐藏特征
web_driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
    "source": """
    Object.defineProperty(navigator, 'webdriver', {
      get: () => undefined
    })
    """
})

web_driver.get("https://www.baidu.com")
web_driver.maximize_window()

wait = WebDriverWait(web_driver, 10)
textarea = wait.until(EC.element_to_be_clickable((By.ID, "chat-input-textarea")))
textarea.send_keys("自动化测试学习")

time.sleep(2)
web_driver.quit()

⚠️ 注意:只能降低触发概率,不能100%避免,大厂风控持续更新

相关推荐
71777718 小时前
厘清 Gitee Test 能力边界:测试管理、自动化与 DevSecOps 协同路径
运维·gitee·自动化
朗宇芯工控19 小时前
工厂 “钢铁焊工”:焊接机器人的技术逻辑与发展方向
机器人·自动化·制造·工业·运动控制系统
代码方舟20 小时前
零信任架构实战:基于天远企业年报信息核验构建自动化高并发尽调网关
运维·人工智能·架构·自动化
zhonyu鱼21 小时前
Home Assistant:开源的智能家居自动化平台,统一控制全屋设备
开源·自动化·智能家居
2301_786756601 天前
不做分子仿真、不布局自动化实验室,垂直科研智能平台同样跑通 AI for Science 可持续变现
运维·人工智能·自动化
志栋智能1 天前
超自动化安全如何提升合规与审计效率?
运维·安全·自动化
小张同学a.1 天前
Ansible自动化运维实战3——变量分离、Roles 角色开发与 Git 托管分发实战
运维·服务器·自动化·ansible·playbook·role
酷可达拉斯1 天前
自动化运维-Ansible Role详解
linux·运维·服务器·自动化·ansible
电化学仪器白超1 天前
MV-CS200-10UC相机参数配置
python·单片机·嵌入式硬件·数码相机·自动化·ltspice