使用 Chrome 浏览器运行 WebDriver 时,收到消息“仅允许本地连接"即使浏览器正常启动 [英] When running WebDriver with Chrome browser, getting message, "Only local connections are allowed" even though browser launches properly

查看:66
本文介绍了使用 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("http://webdunia.com");
        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 时,收到消息“仅允许本地连接"即使浏览器正常启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆