51data 发表于 2020-9-2 14:32:06

RSelenium+Chrome频繁关闭目标窗口

问题:使用RSelenium+Chrome爬取数据时,目标窗口频繁关闭。错误提示:
Selenium message:no such window: target window already closed
from unknown error: web view not found
(Session info: chrome=84.0.4147.135)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64)

Error:          Summary: NoSuchWindow
          Detail: A request to switch to a different window could not be satisfied because the window could not be found.
         Further Details: run errorDetails method

问题分析:因为Chrome浏览器版本和ChromeDriver版本不匹配导致。
解决办法:
方法1.检查Chrome浏览器是否有更新
打开Chrome浏览器—自定义及控制—帮助—关于Google Chrome

方法2.重新选用合适的ChromeDriver版本
ChromeDriver 与 Chrome版本对照关系映射表如下:

ChromeDriverVersionChrome Version
83.0.4103.3983
83.0.4103.1483
81.0.4044.13881
81.0.4044.6981
81.0.4044.2081
80.0.3987.10680
80.0.3987.1680
79.0.3945.3679
79.0.3945.1679
78.0.3904.10578
78.0.3904.7078
78.0.3904.1178
77.0.3865.4077
77.0.3865.1077
76.0.3809.12676
76.0.3809.6876
76.0.3809.2576
76.0.3809.1276
75.0.3770.9075
75.0.3770.875
74.0.3729.674
73.0.3683.6873
72.0.3626.6972
2.4671-73
2.4671-73
2.4570-72
2.4469-71
2.4369-71
2.4268-70
2.4167-69
2.466-68
2.3966-68
2.3865-67
2.3764-66
2.3663-65
2.3562-64

ChromeDriver下载地址: http://npm.taobao.org/mirrors/chromedriver/


页: [1]
查看完整版本: RSelenium+Chrome频繁关闭目标窗口