本文介绍了仅允许本地连接Chrome和Selenium Webdriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Chrome Webdriver 2.23&硒2.53.1.我已经尝试了很多,但是无法解决.每当我运行Selenium脚本时,都会出现以下错误

I am using Chrome webdriver 2.23 & Selenium 2.53.1. I have tried a lot, but could not get it fixed. Whenever I run my selenium script, it is giving me the following error

Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 12162
Only local connections are allowed.

推荐答案

这只是参考消息.您的问题可能是chromedriver版本与selenium-server-standalone版本之间不匹配.

This is just an informational message. Your issue might be a missmatch between the versions of chromedriver and selenium-server-standalone.

尝试使用最新的硒版本3.0,它对我有用.

Try with the latest selenium version 3.0, it is working for me.

请注意,对于selenium 3.0,您需要首先在selenium服务器之后指定驱动程序.

Please not that for selenium 3.0 you need to specify the driver first and after the selenium server.

使用新的硒(3.0)时,您应该使用:

With the new selenium, which is 3.0 you should use:

java -Dwebdriver.chrome.driver = path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jar如果您使用的硒版本低于3.0,则需要使用驱动程序反转硒的顺序,例如:

java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jarIf you are using selenium version below 3.0 you need to reverse the order of selenium with the driver, like:

java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium_server.jar

启动硒服务器时,请使用chromedriver和硒服务器在目录中打开一个控制台,然后执行上述命令.

When you are starting the selenium server, open a console in the directory with chromedriver and selenium server and execute the above command.

这篇关于仅允许本地连接Chrome和Selenium Webdriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 04:09