当前位置:网站首页>selenium chrome driver运行时的cannot determine loading status from target frame detached问题
selenium chrome driver运行时的cannot determine loading status from target frame detached问题
2022-08-02 12:49:00 【bluepad】
selenium chrome driver运行时的cannot determine loading status from target frame detached问题
前言
最近在做本科毕业论文,计划用chrome driver爬取敦煌网,但是在爬取的过程中遇到了以下的问题,一直提示unknown error: cannot determine loading status from target frame detached。
WebDriverException Traceback (most recent call last)
WebDriverException: Message: unknown error: cannot determine loading status
from target frame detached
(Session info: chrome=99.0.4844.51)
1.chrome 和chrome driver版本问题
在网上看到有人说这是因为Google chrome和chrome driver的版本不兼容问题,但是我检查过我的软件版本之后发现不能帮助解决这个问题。
2.关闭科学上网软件
问题解决,好无厘头的错误原因啊。
3.换用BeautifulSoup
问题解决,selenium速度慢效率低,换用BeautifulSoup更加快速高效。
但是我在使用BeautifulSoup时多次出现timeout的报错,以下是我的两个解决方案。
1.设置断连时重新连接五次
requests.adapters.DEFAULT_RETRIES = 5
2.报错后强制sleep20秒
errortime = 0
try:
page_data = requests.get(page_url)
except OSError:
if errortimes == 0:
print("出错了!!!!!连接不上了!!!!!" + page_url)
time.sleep(20)
page_data = requests.get(page_url)
print("已经尝试重新连接了!!!!!")
else:
print("又出错了呀!!!!!" + page_url)
time.sleep(20)
page_data = requests.get(page_url)
print("已经尝试重新连接了!!!!!")
errortimes += 1
4.总结
作为爬虫小白真的踩了好多好多有意义和无意义的坑,毕竟困难总比办法多!!!
哪里写得不好或写错也请您指正!!!
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- How to implement waterfall flow layout (what is waterfall flow layout)
- Drools(8):WorkBench使用
- TFRecord简介,原理分析,代码实现?[通俗易懂]
- pig4cloud服务架构使用
- js秒表倒计时插件
- php - the first of three solid foundations
- simulink PID auto-tuning
- zabbix自动化监控脚本
- LeetCode_377_Combination Sum IV
- Hand rolled architecture, 41 Redis interview asked
猜你喜欢
Intouch System Platform IDE-1
svg balloon rises explosion js special effect
基础协议讲解
Manual architecture, Mysql interview 126 questions
Speed up your programs with bitwise operations
Technology sharing | Description of the electronic fence function in the integrated dispatching system
1.3 Rapid Spanning Tree Protocol RSTP
MyCat2 introduction and installation and basic use
FreeRTOS creation tasks - dynamic creation, static creation
数据湖(二):什么是Hudi
随机推荐
OpenFeign设置header的3种方式
FreeRTOS中名称规范
svg气球升起爆炸js特效
FreeRTOS experiment -- delete task
js true 3d histogram plugin
吾爱第三课-修改版权和资源
Technology sharing | Description of the electronic fence function in the integrated dispatching system
机器人碰撞检测方法形式化
photo-sphere-viewer中文文档
There are several ways to jump to js source code, jump on the current page, jump on the blank page
Chapter 14 Manually create a REST service (2)
Object.entries()
FreeRTOS experiment--one function creates multiple tasks
你知道图论的spfa吗?
openGauss数据库基本操作(超详细)
FreeRTOS--stack experiment
图论之Kruskal,最小生成树如何优雅解题?
Intouch System Platform IDE-1
定了!2022世界VR产业大会将继续在南昌召开
js炫酷仪表盘插件