问题:使用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版本对照关系映射表如下:
ChromeDriver Version | | 83.0.4103.39 | | 83.0.4103.14 | | 81.0.4044.138 | | 81.0.4044.69 | | 81.0.4044.20 | | 80.0.3987.106 | | 80.0.3987.16 | | 79.0.3945.36 | | 79.0.3945.16 | | 78.0.3904.105 | | 78.0.3904.70 | | 78.0.3904.11 | | 77.0.3865.40 | | 77.0.3865.10 | | 76.0.3809.126 | | 76.0.3809.68 | | 76.0.3809.25 | | 76.0.3809.12 | | 75.0.3770.90 | | 75.0.3770.8 | | 74.0.3729.6 | | 73.0.3683.68 | | 72.0.3626.69 | | 2.46 | | 2.46 | | 2.45 | | 2.44 | | 2.43 | | 2.42 | | 2.41 | | 2.4 | | 2.39 | | 2.38 | | 2.37 | | 2.36 | | 2.35 | |
ChromeDriver下载地址: http://npm.taobao.org/mirrors/chromedriver/
|
|