去除自动化特征

✅ 现象说明

这是 百度风控: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%避免,大厂风控持续更新

相关推荐
goehou7 小时前
让 AI 替我操作这台电脑,先把手能伸多远定下来
windows·自动化·权限管理·ai agent
Frankie_stand8 小时前
测试自动化实战指南:从脚本化、自动判据到 CI 集成的完整落地路径
android·ci/cd·自动化
总裁余(余登武)1 天前
【python项目】:1操作EXCEl自动化开发
python·自动化·excel
海洋之恒2 天前
GitHub Actions 自动化:5 个真实运维提效案例
运维·自动化·github
lisw052 天前
用于医疗的磁驱动柔性微机器人研究进展!
机器人·自动化·硬件工程
Sakura_j_h_2 天前
从零写一个 MCP stdio Server:用 Python 校验博客文章格式
开发语言·python·自动化·ai工具·mcp·json-rpc
lisw053 天前
基于神经网络的机器人导航系统的设计与执行!
神经网络·机器人·自动化
严肃小白兔3 天前
Cloudflare 更新 API Token 管理:从最小权限到自动化凭据安全
网络·安全·自动化
2601_968793143 天前
Python Requests 轻量自动化:无需浏览器,实现真人级账号浏览模拟
开发语言·python·自动化
无忧_wy3 天前
MoneyPrinterTurbo 自动化视频生成实战指南
运维·人工智能·自动化·音视频