【发布时间】:2014-05-21 15:24:41
【问题描述】:
当我尝试运行多个 webdriver 测试,每个测试都尝试使用 firefox 时,我遇到了问题。
以下是我得到的错误
Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'ip-172-31-23-96.us-west-2.compute.internal', ip: '172.31.23.96', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-24-generic', java.version: '1.7.0_55'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:98)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:84)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at feedbackWorksproperly.main(feedbackWorksproperly.java:23)
sudo javac -cp ".:/includes/selenium-2.41.0/selenium-java-2.41.0-srcs.jar:/includes/selenium-2.41.0/selenium-java-2.41.0.jar:/includes/selenium-2.41.0/libs/*" feedbackWorksproperly.java
sudo java -cp ".:/includes/selenium-2.41.0/selenium-java-2.41.0-srcs.jar:/includes/selenium-2.41.0/selenium-java-2.41.0.jar:/includes/selenium-2.41.0/libs/*" feedbackWorksproperly
以下是我初始化webdriver的方式
String Xport = System.getProperty("lmportal.xvfb.id", ":1");
final File firefoxPath = new File(System.getProperty("lmportal.deploy.firefox.path",
"/usr/bin/firefox"));
FirefoxBinary firefoxBinary = new FirefoxBinary(firefoxPath);
firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);
FirefoxDriver wd;
wd = new FirefoxDriver(firefoxBinary, null);
注意我有一个休息服务器,它根据请求运行测试。因此,每次收到包含 java 代码的请求时,它都会继续运行测试,独立于当前在服务器上运行的其他测试。
【问题讨论】:
-
抱歉,我不明白你的“多个 webdriver 测试”到底是怎么回事?
标签: firefox selenium selenium-webdriver webdriver