使用 Chrome 浏览器运行 WebDriver 时,收到消息“仅允许本地连接"即使浏览器正常启动

编程入门 行业动态 更新时间:2024-10-10 13:13:36
本文介绍了使用 Chrome 浏览器运行 WebDriver 时,收到消息“仅允许本地连接"即使浏览器正常启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我使用 WebDriver 运行 Chrome 浏览器时,我在控制台上收到以下消息.请让我知道如何解决它.

When I run Chrome browser using WebDriver, I am getting following message on console. Please let me know how to resolve it.

"在端口 22582 上启动 ChromeDriver (v2.10.267521)" "仅本地允许连接."

"Starting ChromeDriver (v2.10.267521) on port 22582 " "Only local connections are allowed."

这是我的示例代码:

public class Browserlaunch { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\chromedriver_win32 \chromedriver.exe"); WebDriver driver = new ChromeDriver() ; driver.get("webdunia"); driver.close(); driver.quit(); } }

推荐答案

这只是一条信息性消息.该消息告诉您的是 chromedriver 可执行文件将只接受来自本地计算机的连接.

This is an informational message only. What the message is telling you is that the chromedriver executable will only accept connections from the local machine.

大多数驱动程序实现(Chrome 驱动程序和 IE 驱动程序)都会创建一个 HTTP 服务器.语言绑定(Java、Python、Ruby、.NET 等)都使用 JSON-over-HTTP 协议与驱动程序通信并使浏览器自动化.由于 HTTP 服务器只是在一个开放端口上侦听由语言绑定生成的 HTTP 请求,因此到由语言绑定启动的 HTTP 服务器的连接只允许来自同一主机上的其他进程.请注意,此限制不适用于浏览器可以与外部网站建立的连接;相反,它只是阻止来自其他网站的传入连接.

Most driver implementations (the Chrome driver and the IE driver for sure) create a HTTP server. The language bindings (Java, Python, Ruby, .NET, etc.) all use a JSON-over-HTTP protocol to communicate with the driver and automate the browser. Since the HTTP server is simply listening on an open port for HTTP requests generated by the language bindings, connections to the HTTP server started by the language bindings are only allowed to come from other processes on the same host. Note carefully that this limitation does not apply to connections the browser can make to outside websites; rather it simply prevents incoming connections from other websites.

更多推荐

使用 Chrome 浏览器运行 WebDriver 时,收到消息“仅允许本地连接"即使浏览器正常启动

本文发布于:2023-11-28 18:36:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643509.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   本地连接   消息   Chrome   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!