我正在使用 Chrome webdriver 2.23 和 Selenium 2.53.1。 我已经尝试了很多,但无法修复它。每当我运行我的 selenium 脚本时,它都会给出以下错误
Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 12162
Only local connections are allowed.
最佳答案
这只是一条信息性消息。您的问题可能是 chromedriver 和 selenium-server-standalone 的版本不匹配。
尝试使用最新的 selenium 3.0 版本,它对我有用。
请注意,对于 selenium 3.0,您需要先指定驱动程序,然后再指定 selenium 服务器。
对于新的 selenium,即 3.0,您应该使用:
java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jar 如果您使用低于 3.0 的 selenium 版本,则需要反转驱动程序中 selenium 的顺序,例如:java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium_server.jar
当您启动selenium服务器时,在chromedriver和selenium服务器所在的目录中打开一个控制台并执行上述命令。
关于selenium - 仅允许本地连接 Chrome 和 Selenium webdriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38846079/