在Jenkins中执行Selenium HTML测试套件无法在Firefox中启动

3

我正在尝试将Jenkins与Selenium集成。 我已准备好以下命令:

java -jar <Full Path of the Selenium RC Jar, including jar file name> \
 -htmlSuite *firefox "<Application URL>" \
 "<Test Suite Path Including test suite name>" "<Results file name>"

当我在命令行中执行该命令时,它可以正常工作。然后,我通过Jenkins调用相同的命令,但是出现了以下错误:

INFO - Preparing Firefox profile...
HTML suite exception seen:
java.lang.RuntimeException: Timed out waiting for profile to be created!
    at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360)
    at

然后我们为Firefox创建了一个配置文件并使用该配置文件运行。现在我遇到了以下错误:
516 [main] INFO org.openqa.jetty.util.Container - Started org.openqa.jetty.jetty.Server@13f3045
HTML suite exception seen:
java.lang.NullPointerException
    at org.openqa.selenium.io.FileHandler.copyDir(FileHandler.java:229)
    at org.openqa.selenium.io.FileHandler.copy(FileHandler.java:213)
    at org.openqa.selenium.io.FileHandler.copy(FileHandler.java:200)
    at org.openqa.selenium.browserlaunchers.LauncherUtils.copyDirectory(LauncherUtils.java:223)
    at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.copyDirectory(FirefoxChromeLauncher.java:147)
    at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.initProfileTemplate(FirefoxChromeLauncher.java:174)
    at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.makeCustomProfile(FirefoxChromeLauncher.java:221)
    at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:89)
    at

我有jenkins 1.452和seleniumHQ2.0
如有帮助将不胜感激。

Jenkins运行在哪个用户下?它是否以root身份运行? - JScoobyCed
你的操作系统是什么?Windows还是Linux? - Ripon Al Wasim
4个回答

4
在我调用Selenium RC之前,我添加了一个命令来导出显示器,并且通过这个命令,我能够从Jenkins运行Selenium RC。
我执行的命令是:
export DISPLAY=:0;

1

我在尝试让Selenium无头运行时遇到了相同的错误。经过一番搜索,我意识到我以Selenium用户身份运行时没有访问我创建的Firefox配置文件目录的权限。更改配置文件目录的权限使我成功解决了这个错误。


1
你可能想要为Firefox中的Selenium准备一个配置文件:可以查看this是否有帮助(答案未标记为已回答,但OP发布了他的解决方案。

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接