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)

显示结果如下

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

相关推荐
int WINGsssss4 小时前
【无标题】
pytorch·分布式·python
q_30238195565 小时前
Python实现基于多模态知识图谱的中医智能辅助诊疗系统:迈向智慧中医的新篇章
开发语言·python·知识图谱
我的xiaodoujiao5 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 31--开源电商商城系统项目实战--加入购物车、提交订单测试场景
python·学习·测试工具·pytest
梨落秋霜5 小时前
Python入门篇【输入input】
开发语言·python
Buxxxxxx5 小时前
DAY 34 模块和库的导入
开发语言·python
qq_356196955 小时前
day30函数专题1:函数定义和参数@浙大疏锦行
python
haiyu_y5 小时前
Day 27 通用机器学习流水线
人工智能·python·机器学习
CHANG_THE_WORLD5 小时前
“元组“名称的由来
python
Silence_Jy5 小时前
deepseek-R1技术报告解析
python·深度学习·transformer