Unable to connect to the chrome remote debugging server localhost 9222

我所遇到的问题是使用cdp4j技术进行爬虫操作,cdp4j会对chrome浏览器进行复用。但是在对chrome浏览器进行更新后,便出现了该问题。

解决方法

1.设置环境变量

Unable to connect to the chrome remote debugging server localhost 9222_第1张图片

 Unable to connect to the chrome remote debugging server localhost 9222_第2张图片

在PATH中设置该环境变量

2. cmd中运行命令行语句启动chrome浏览器

(1)启动(启动之前关闭所有的chrome浏览器界面):

chrome --remote-debugging-port=9222

启动后会自动打开chrome浏览器
(2)启动后输入语句进行验证查看是否存在9222端口

netstat -na|findstr 9222

(3)当存在上方图片中的进程后便可以在打开的浏览器界面中正常进行操作

Unable to connect to the chrome remote debugging server localhost 9222_第3张图片

 3.看到上方的端口进程就代表9222端口可以被访问到了

你可能感兴趣的:(Java爬虫,chrome,网络爬虫)