Selenium 硒测试获胜';t使用FirefoxDriver在jenkins中运行,在本地桌面上运行良好

Selenium 硒测试获胜';t使用FirefoxDriver在jenkins中运行,在本地桌面上运行良好,selenium,jenkins,selenium-firefoxdriver,Selenium,Jenkins,Selenium Firefoxdriver,我试图让我的selenium测试在Jenkins中运行,但面临以下问题。使用maven test或intellij运行时,测试在本地计算机上运行良好 Firefox 39 x64 硒2.46.0 SeleniumHQ插件(自动更新,所以应该是最新版本) 根据这一点,Xvfb服务器应该正在运行 Xvfb starting$ Xvfb :1 -screen 0 1024x758x16 -fbdir /data/jenkins/xvfb-64-6044594236651529452.fbdir 问题

我试图让我的selenium测试在Jenkins中运行,但面临以下问题。使用maven test或intellij运行时,测试在本地计算机上运行良好

Firefox 39 x64
硒2.46.0
SeleniumHQ插件(自动更新,所以应该是最新版本)

根据这一点,Xvfb服务器应该正在运行

Xvfb starting$ Xvfb :1 -screen 0 1024x758x16 -fbdir /data/jenkins/xvfb-64-6044594236651529452.fbdir
问题在哪里?在互联网上搜索了两天,并尝试了我找到的所有东西之后,我想不出来

资料来源:

public void setUp() throws Exception {
        String Xport = System.getProperty("lmportal.xvfb.id", ":1");
        FirefoxBinary firefoxBinary = new FirefoxBinary();
        firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);
        driver = new FirefoxDriver(firefoxBinary, null);
        baseUrl = BASE_URL;
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }
错误:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    1436973591335   DeferredSave.extensions.json    DEBUG   Save changes
    1436973591336   addons.xpi  DEBUG   Updating XPIState for {"id":"fxdriver@googlecode.com","syncGUID":"NERSGr4g-th8","location":"app-profile","version":"2.46.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Firefox WebDriver","description":"WebDriver implementation for Firefox","creator":"Simon Stewart","homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/tmp/anonymous134216584359310857webdriver-profile/extensions/fxdriver@googlecode.com","installDate":1436973590000,"updateDate":1436973590000,"applyBackgroundUpdates":1,"bootstrap":false,"size":8440790,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":true,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"3.0","maxVersion":"66.*"}],"targetPlatforms":[{"os":"Darwin","abi":null},{"os":"SunOS","abi":null},{"os":"FreeBSD","abi":null},{"os":"OpenBSD","abi":null},{"os":"WINNT","abi":"x86-msvc"},{"os":"Linux","abi":null}],"multiprocessCompatible":false}
    1436973591336   addons.xpi  DEBUG   getModTime: Recursive scan of fxdriver@googlecode.com
    1436973591338   addons.xpi  DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
    1436973591340   addons.xpi-utils    DEBUG   Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
    1436973591340   DeferredSave.extensions.json    DEBUG   Save changes
    1436973591340   DeferredSave.extensions.json    DEBUG   Save changes
    1436973591340   addons.xpi  DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"oj50TlNJya_g","location":"app-global","version":"39.0","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/data/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/Firefox/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}","installDate":1435710843000,"updateDate":1435710843000,"applyBackgroundUpdates":1,"skinnable":true,"size":3169,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"39.0","maxVersion":"39.0"}],"targetPlatforms":[]}
    1436973591340   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
    1436973591341   addons.xpi  DEBUG   Updating database with changes to installed add-ons
    1436973591341   addons.xpi-utils    DEBUG   Updating add-on states
    1436973591341   addons.xpi-utils    DEBUG   Writing add-ons list
    1436973591345   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
    1436973591346   addons.manager  DEBUG   Provider finished startup: XPIProvider
    1436973591346   addons.manager  DEBUG   Starting provider: LightweightThemeManager
    1436973591346   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
    1436973591346   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
    1436973591346   addons.manager  DEBUG   Starting provider: GMPProvider
    1436973591350   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
    1436973591351   addons.manager  DEBUG   Provider finished startup: GMPProvider
    1436973591351   addons.manager  DEBUG   Starting provider: PluginProvider
    1436973591351   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
    1436973591351   addons.manager  DEBUG   Provider finished startup: PluginProvider
    1436973591352   addons.manager  DEBUG   Completed startup sequence
    1436973591586   DeferredSave.extensions.json    DEBUG   Starting timer

        at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:120)
        at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:275)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:116)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
        at cz.bsc.g6.mbs.pda.selenium.ide.Base.setUp(Base.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
org.openqa.selenium.firefox.NotConnectedException:45000毫秒后无法连接到端口7055上的主机127.0.0.1。firefox控制台输出:
1436973591335 DeferredSave.extensions.json调试保存更改
1436973591336 addons.xpi调试更新{“id”的XPIState:fxdriver@googlecode.com“,”syncGUID“:”NERSGr4g-th8“,”位置“:”应用程序配置文件“,”版本“:”2.46.0“,”类型“:”扩展“,”内部名称“:null,“updateURL”:null,“updateKey”:null,“optionsURL”:null,“optionsType”:null,“aboutURL”:null,“icon64URL”:null,“defaultLocale”:{”名称“:”“Firefox WebDriver”,“描述”:“Firefox的WebDriver实现”,“创建者”:“Simon Stewart”,“homepageURL”:null},“可见”:true,“活动”:true,“userDisabled”:false,“appDisabled”:false,“描述符”:/tmp/Anonymous1342165835310857WebDriver配置文件/扩展/fxdriver@googlecode.com,“安装日期”:143697359000,“更新日期”:143697359000applyBackgroundUpdates:1,“bootstrap”:false,“size”:8440790,“sourceURI”:null,“releaseNotesURI”:null,“softDisabled”:false,“foreignInstall”:true,“hasBinaryComponents”:true,“strictCompatibility”:false,“locales”:[],“targetApplications”:[{“id”:“{ec8030f7-c20a-464f-9b0e-13a3a9e97384}”,“minVersion”:“3.0”,“maxVersion”:“66.*],“TargetPlatform”:“{“os”:”达尔文,abi:null},{os:“SunOS”,“abi:null},{os:“FreeBSD”,“abi:null},{os:“OpenBSD”,“abi:null},{os:“WINNT”,“abi:“x86 msvc”},{os:“Linux”,“abi:null}],“多处理器兼容”:false}
1436973591336 addons.xpi DEBUG getModTime:的递归扫描fxdriver@googlecode.com
1436973591338 addons.xpi调试安装在app global中的新加载项{972ce4c6-7e08-4474-a285-3208198ce6fd}
1436973591340 addons.xpi-utils调试使addon应用程序全局:{972ce4c6-7e08-4474-a285-3208198ce6fd}可见
1436973591340 DeferredSave.extensions.json调试保存更改
1436973591340 DeferredSave.extensions.json调试保存更改
1436973591340 addons.xpi调试更新XPIState for{“id”:“{972ce4c6-7e08-4474-a285-3208198ce6fd}”,“syncGUID”:“oj50TlNJya_g”,“location”:“app global”,“version”:“39.0”,“type”:“theme”,“internalName”:“classic/1.0”,“updateURL”:null,“updateKey”:null,“optionsURL”:null,“optionsType”:null,“aboutURL”:null,“iconURL”:null,“icon64URL”:null,“defaultLocale”“:{”name:“Default”,“description:“The Default theme.”,“creator:“Mozilla”,“homepageURL:”null,“contributors:”[“Mozilla contributors”]},“visible”:true,“active”:true,“userDisabled”:false,“appDisabled”:false,“descriptor:”/data/jenkins/tools/com.cloudbees.jenkins.customtools.CustomTool/Firefox/Firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd},“安装日期”:143571084300,“更新日期”:143571084300,“applyBackgroundUpdates”:1,“skinnable”:true,“size”:3169,“sourceURI”:null,“releaseNotesURI”:null,“softDisabled”:false,“foreignInstall”:false,“hasBinaryComponents”:false,“StricCompatibility”:true,“locales”:[],“targetApplications”:[{“id”:”:”{ec8030f7-c20a-464f-9b0e-13a3a9e97384},“minVersion”:“39.0”,“maxVersion”:“39.0”}],“TargetPlatform”:[]}
1436973591340 addons.xpi DEBUG getModTime:递归扫描{972ce4c6-7e08-4474-a285-3208198ce6fd}
1436973591341 addons.xpi调试使用对已安装加载项的更改更新数据库
1436973591341 addons.xpi-utils调试更新加载项状态
1436973591341加载项.xpi-utils调试写入加载项列表
1436973591345 addons.manager调试为XPIProvider注册关机阻止程序
1436973591346 addons.manager调试提供程序已完成启动:XPIProvider
1436973591346 addons.manager调试启动提供程序:LightweightTheManager
1436973591346 addons.manager调试为Lightweight TheManager注册关机阻止程序
1436973591346 addons.manager调试提供程序已完成启动:LightweightTheManager
1436973591346 addons.manager调试启动提供程序:GMPProvider
1436973591350 addons.manager调试为GMPProvider注册关机阻止程序
1436973591351 addons.manager调试提供程序已完成启动:GMPProvider
1436973591351 addons.manager调试启动提供程序:PluginProvider
1436973591351 addons.manager调试为PluginProvider注册关机阻止程序
1436973591351 addons.manager调试提供程序已完成启动:PluginProvider
1436973591352 addons.manager调试已完成启动序列
1436973591586 delferredsave.extensions.json调试启动计时器
位于org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:120)
位于org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:275)
位于org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDriver.java:116)
位于org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:220)
位于org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java:215)
位于org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:211)
位于cz.bsc.g6.mbs.pda.selenium.ide.Base.setUp(Base.java:52)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:606)
在org.junit.run