Selenium 被反爬 报400 打不开

直接使用第三方开源的driver undetected-chromedriver

开源地址:https://github.com/ultrafunkamsterdam/undetected-chromedriver

它自带一些常见的因为浏览器环境问题被反爬的反反爬配置,可以规避部分风控。

使用

1、安装依赖

python 复制代码
pip install undetected-chromedriver

2、替换原生的Selenium

python 复制代码
import undetected_chromedriver as uc
driver = uc.Chrome(headless=True,use_subprocess=False)
driver.get('https://nowsecure.nl')
driver.save_screenshot('nowsecure.png')

完成

经测试,某知识产权网可用

附带浏览器环境检测网址:https://bot.sannysoft.com/

相关推荐
Patrick在香港8 分钟前
Claude API 成本直降90%:Prompt Caching 提示词缓存 Python 实战
python·缓存·prompt
郝学胜-神的一滴32 分钟前
并查集深度入门:从玄学抽象到 QuickFind & QuickUnion 源码实战
数据结构·c++·python·程序人生·算法·软件开发
她说可以呀39 分钟前
Spring AI 常用 Advisor
人工智能·python·spring
小玮看世界1 小时前
[Python] str() 和 join() 的区别与实战避坑指南
前端·javascript·python
卷无止境1 小时前
FastAPI 的 WebSocket 装了些什么
后端·python·fastapi
码云骑士1 小时前
108-vLLM推理引擎-PagedAttention-连续批处理-吞吐提升10倍
python·vllm
DeepVisionary1 小时前
从微软砍掉Copilot的AI播客、Deep Research看AI产品“做减法“:个人版与企业版合并,超级应用呼之欲出
python·自动化
IT·侯老师1 小时前
qq-auto-reply
python
迷迭香yy1 小时前
大宗交易折溢价因子怎么挖掘本地化Python全流程实战
开发语言·人工智能·python
卷无止境1 小时前
FastAPI 的 Request 类装了什么
后端·python