【问题标题】:How to run multiple firefox webdriver tests如何运行多个 firefox webdriver 测试
【发布时间】: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


【解决方案1】:

我猜你同时运行两个驱动程序? 如果是这样的话,

Unable to bind to locking port 7054

看起来另一个正在同一个端口上运行。使用不同的端口可能会起作用。

但是我建议使用 Selenium Grid 在不同的浏览器/并行上运行测试
http://code.google.com/p/selenium/wiki/Grid2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-07
    • 1970-01-01
    • 2020-02-29
    • 2017-02-10
    • 1970-01-01
    • 2014-05-02
    • 1970-01-01
    • 2014-10-27
    相关资源
    最近更新 更多