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

查看:2697
本文介绍了当使用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."

以下是我的示例代码:

Here is my sample code:

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服务器连接被限制为仅允许来自同一主机上的其他进程。请注意,此限制不适用于浏览器可连接到外部网站的连接;而是简单地阻止来自其他网站的来电连接。

You see, most driver implementations (the Chrome driver and the IE driver for sure) create an HTTP server, and the language bindings (Java, Python, Ruby, .NET, etc.) all use a JSON-over-HTTP protocol to communicate with the driver, and automate the browser. Naturally, 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 restricted to only be 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 simple prevents incoming connections from other websites.

这篇关于当使用Chrome浏览器运行WebDriver时,获取消息“仅允许本地连接”即使浏览器正常启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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