硒-无法找到空闲端口 [英] Selenium - Unable to find a free port

查看:56
本文介绍了硒-无法找到空闲端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在FreeBSD服务器上运行一个依赖硒的应用程序.在启动过程中,我遇到了一个例外:

I'm running an app that depends on selenium on FreeBSD server. During the startup I've got the exception:

Caused by: java.lang.RuntimeException: Unable to find a free port
        at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:67) ~[selenium-remote-driver-2.53.1.jar:na]

我在互联网上找到了一些解决方案,应该从hosts文件中删除包含"localhost"的条目,但是我没有这样做的权限.

I've found some solutions on the internet that the entries which contains 'localhost' should be removed from the hosts file, but I don't have a permission to do that.

您知道如何在不修改/etc/hosts文件的情况下解决该问题吗?

Do you know how to fix the problem without modifying /etc/hosts file?

推荐答案

以防万一,如果您正在远程服务器上运行脚本.然后确保几点:

Just in case if you are running your scripts on remote server. Then make sure about few points:

  1. 每次测试运行后始终关闭或退出浏览器.
  2. 以防万一,如果第一个点不起作用,请增加远程服务器上的端口范围.

这篇关于硒-无法找到空闲端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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