selenium绕过网站检测的方法

使用selenium打开如下网站,进行检测,代码如下:

python 复制代码
from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get('https://bot.sannysoft.com/')
time.sleep(60)

发现webdriver被检测到了

在这里可使用一个selenium提供的插件undetected_chromedriver,使用这个可以通过检测。

python 复制代码
import undetected_chromedriver as undetected_diver
import time

driver = undetected_diver.Chrome(driver_executable_path=r'C:\Program Files\Google\Chrome\Application\undetected_chromedriver.exe',
                       browser_executable_path=r'C:\Program Files\Google\Chrome\Application\chrome.exe',
                       use_subprocess=True)
driver.get('https://bot.sannysoft.com/')
time.sleep(60)

显示结果如下

使用这个,对于一些有网站有瑞数加密的都可以通过,非常强大。

相关推荐
用户8356290780512 小时前
使用 Python 自动化 PowerPoint 形状布局与格式设置
后端·python
用户8356290780513 小时前
用 Python 自动化 PowerPoint 演讲者备注添加
后端·python
黄忠9 小时前
01-系统架构设计-LangGraph状态机与多源异构RAG
python
zzzzzz3109 小时前
假如我是掘金管理员,我先给评论区装个'代码审查'系统
python·程序员·机器人
砍材农夫10 小时前
python环境|conda安装和使用(2)
后端·python
程序员龙叔1 天前
编写高质量 Skill 系列 -- 如何设计需求分析与用例生成的 SKILL
自动化测试·软件测试·python·软件测试工程师·接口测试·性能测试·skill·ai测试
用户8356290780511 天前
使用 Python 操作 Word 内容控件
后端·python
码云骑士1 天前
32-慢查询排查全流程(下)-索引优化实战与最左前缀原则
python
闵孚龙1 天前
《PyTorch 深度修炼》Dataset 和 DataLoader:数据如何喂给模型
人工智能·pytorch·python