使用Jenkins做项目打包和部署,在上一篇文章写的有,本文主要讲在部署到TOMCAT SERVER上以后,项目正常运行,然后我执行自动化测试时,遇到下面的问题
在LINUX上面已经安装了Firefox,并且使用VNC可以连接上去,在上面已经有运行的1
然后我用下面命令,发现firefox可以运行的。
最后的原因是jenkins在安装的时候,会创建一个jenkins,它使用jenkins运行FIREFOX导致错误出现,解决办法是把jenkins改成root,在/etc/sysconfig/下面有一个jenkins文件
然后service jenkins restart 再次运行就OK了。
错误:
[img]http://dl2.iteye.com/upload/attachment/0087/8635/2dc425c4-cae9-3d27-8e78-942b50297546.jpg[/img]
正确:
[img]http://dl2.iteye.com/upload/attachment/0087/8637/d2629b5f-f5d0-394a-a528-074c63a23cfb.jpg[/img]
09:58:43.947 INFO - Checking Resource aliases
09:58:43.955 INFO - Command request: getNewBrowserSession[*firefox /usr/bin/firefox, http://XXXXXXXX:8080/TEST-GUI/, , addCustomRequestHeaders=true] on session null
09:58:43.960 INFO - creating new remote session
09:58:43.981 WARN - Caution: '/usr/bin/firefox': file is a script file, not a real executable. The browser environment is no longer fully under RC control
09:58:43.997 INFO - Allocated session 7553cfee1b99480a8b03895157dd1790 for http://XXXXXXXX:8080/TEST-GUI/, launching...
09:58:44.383 INFO - Preparing Firefox profile...
09:59:04.653 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Timed out waiting for profile to be created!
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:360)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:412)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:114)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:381)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:125)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:811)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:437)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:407)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:151)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
09:59:04.662 INFO - Got result: Failed to start new browser session: Error while launching browser on session null
09:59:14.752 INFO - Command request: shutDownSeleniumServer[, ] on session null
在LINUX上面已经安装了Firefox,并且使用VNC可以连接上去,在上面已经有运行的1
-rw-r--r-- 1 root root 4512 Aug 2 17:46 Test-Jenkins:1.log
-rw-r--r-- 1 root root 6 Aug 2 11:47 Test-Jenkins:1.pid
-rw------- 1 root root 8 Aug 2 10:26 passwd
-rwxr-xr-x 1 root root 352 Aug 2 11:47 xstartup
-rwxr-xr-x 1 root root 654 Aug 2 11:20 xstartup_bk_original
然后我用下面命令,发现firefox可以运行的。
$>export DISPLAY=:1
$>firefox
最后的原因是jenkins在安装的时候,会创建一个jenkins,它使用jenkins运行FIREFOX导致错误出现,解决办法是把jenkins改成root,在/etc/sysconfig/下面有一个jenkins文件
## Type: string
## Default: "jenkins"
## ServiceRestart: jenkins
#
# Unix user account that runs the Jenkins daemon
# Be careful when you change this, as you need to update
# permissions of $JENKINS_HOME and /var/log/jenkins.
#
#JENKINS_USER="jenkins"
JENKINS_USER="root"
然后service jenkins restart 再次运行就OK了。
错误:
[img]http://dl2.iteye.com/upload/attachment/0087/8635/2dc425c4-cae9-3d27-8e78-942b50297546.jpg[/img]
正确:
[img]http://dl2.iteye.com/upload/attachment/0087/8637/d2629b5f-f5d0-394a-a528-074c63a23cfb.jpg[/img]