2013-04-23 96 views
0

我想在詹金斯设置一个简单的硒测试。我的操作系统是Debian GNU/Linux 6.0.7(squeeze),桌面版本(64位)。我卸载了提供的浏览器iceweasel,并用aptitude安装了Firefox。 Firefox的版本是“20.0”。我也安装了谷歌浏览器。我可以通过在终端窗口中编写“firefox”来运行Firefox。 Jenkins与aptitude一起安装。詹金斯和Seleniumhq配置

因此,我在Jenkins中安装了一个名为Seleniumhq的插件。这是我的设置:

enter image description here

然后我收到一个错误的詹金斯控制台时,我尝试建立:

Started by user anonymous 
Building in workspace /var/lib/jenkins/workspace/selenium2 
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates  -htmlSuite *firefox http://site.com /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html 
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite *firefox http://site.com  /var/lib/jenkins/jobs/Selenium1/suites/suite1.html /var/lib/jenkins/jobs/Selenium1/logs/selenium.html 
13:32:18.507 INFO - Java: Sun Microsystems Inc. 14.0-b16 
13:32:18.508 INFO - OS: Linux 2.6.32-5-amd64 amd64 
13:32:18.512 INFO - v2.0 [b2], with Core v2.0 [b2] 
13:32:18.604 INFO - RemoteWebDriver instances should connect to:  http://127.0.0.1:4444/wd/hub 
13:32:18.605 INFO - Version Jetty/5.1.x 
13:32:18.606 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] 
13:32:18.606 INFO - Started HttpContext[/selenium-server,/selenium-server] 
13:32:18.607 INFO - Started HttpContext[/,/] 
13:32:18.616 INFO - Started [email protected] 
13:32:18.616 INFO - Started HttpContext[/wd,/wd] 
13:32:18.621 INFO - Started SocketListener on 0.0.0.0:4444 
13:32:18.621 INFO - Started [email protected] 
HTML suite exception seen: 
java.lang.RuntimeException: java.lang.RuntimeException: Firefox 3 could not be found in the path! 
Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment 
variable, or explicitly specify a path to Firefox 3 like this: 
*firefox3/blah/blah/firefox-bin 
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(Bro wserLauncherFactory.java:160) 
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(Browse rLauncherFactory.java:99) 
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.getBrowserLauncher(HTMLLauncher.java:58) 
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:114) 
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166) 
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557) 
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250) 
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210) 
    Caused by: java.lang.RuntimeException: Firefox 3 could not be found in the path! 
    Please add the directory containing ''firefox-bin' or 'firefox'' to your PATH environment 
    variable, or explicitly specify a path to Firefox 3 like this: 
*firefox3/blah/blah/firefox-bin 
at org.openqa.selenium.browserlaunchers.locators.Firefox2or3Locator.findBrowserLocationOrFail(Firefox2or3Locator.java:26) 
at org.openqa.selenium.server.browserlaunchers.BrowserInstallationCache.locateBrowserInstallation(BrowserInstallationCache.java:27) 
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.<init>(FirefoxLauncher.java:52) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:532) 
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:153) 
... 7 more 
Finished: SUCCESS 

我也试图把这个在浏览器领域: *火狐/ usr/bin/firefox 我认为Firefox安装在那里(我运行“找到Firefox”)。 这种配置使得另一个错误消息:

... 
HTML suite exception seen: 
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox 

Supported browsers include: 
*firefox 
*mock 
*firefoxproxy 
*pifirefox 
*chrome 
*iexploreproxy 
*iexplore 
*firefox3 
*safariproxy 
*googlechrome 
*konqueror 
*firefox2 
*safari 
*piiexplore 
*firefoxchrome 
*opera 
*iehta 
*custom 
.... 

是否有人对如何解决这个想法? 谢谢!

编辑

我更改了浏览器设置来: *火狐的/ opt /火狐/火狐(带之间的空间) 现在看来Firefox中都可以找到,但我得到另一个错误:

Started by user anonymous 
Building in workspace /var/lib/jenkins/workspace/selenium2 
java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar -trustAllSSLCertificates -htmlSuite *firefox /opt/firefox/firefox http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html 
[selenium2] $ java -jar /var/lib/jenkins/selenium-server-standalone-2.0b2.jar - trustAllSSLCertificates -htmlSuite "*firefox /opt/firefox/firefox" http://site.com /var/lib/jenkins/jobs/selenium2/suites/suite1.html /var/lib/jenkins/jobs/selenium2/logs/selenium.html 
10:51:15.567 INFO - Java: Sun Microsystems Inc. 14.0-b16 
10:51:15.569 INFO - OS: Linux 2.6.32-5-amd64 amd64 
10:51:15.572 INFO - v2.0 [b2], with Core v2.0 [b2] 
10:51:15.668 INFO - RemoteWebDriver instances should connect to:  http: //127.0.0.1:4444/wd/hub 
10:51:15.669 INFO - Version Jetty/5.1.x 
10:51:15.669 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] 
10:51:15.670 INFO - Started HttpContext[/selenium-server,/selenium-server] 
10:51:15.670 INFO - Started HttpContext[/,/] 
10:51:15.680 INFO - Started [email protected] 
10:51:15.680 INFO - Started HttpContext[/wd,/wd] 
10:51:15.685 INFO - Started SocketListener on 0.0.0.0:4444 
10:51:15.685 INFO - Started [email protected] 
10:51:15.743 INFO - Preparing Firefox profile... 
HTML suite exception seen: 
java.lang.NullPointerException 
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:259) 
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirec tory(FirefoxChromeLauncher.java:117) 
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:84) 
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:406) 
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:106) 
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:121) 
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:166) 
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:557) 
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:250) 
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:210) 
    10:51:35.789 INFO - Shutting down... 
    Finished: SUCCESS 
+0

尝试增加火狐20.0路径使用导出CLASSPATH声明。 – Hemanth 2013-04-23 11:58:12

+0

你的意思是在Jenkins系统配置中?应该在哪里做? – Jojje 2013-04-23 12:03:25

+0

在您运行selenium脚本的系统的终端中运行以下命令。 'export CLASSPATH =%path%;你的firefox二进制文件的路径' – Hemanth 2013-04-23 12:05:51

回答

0
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox 

语法错误。尝试* firefox或* firefox [插入目录]

1

你应该尝试从shell运行命令行,看看会发生什么。这当然是一个问题,它与硒所使用的Firefox的默认配置文件有关。

在我的情况下,问题是,Firefox是通过显示可以恢复的选项卡开始。

您也可以尝试创建一个特定的配置文件: firefox -pfirefox -ProfileManager

然后使用命令行参数使用专用的个人资料:
-firefoxProfileTemplate /home/userXXX/.mozilla/firefox/ljhyckqd.Selenium

+0

这个解决方案为我在Debian 3.2.0-4-amd64上运行Firefox从这个Repo工作:deb http://packages.linuxmint.com debian import。但是,一旦我从命令提示符运行配置文件管理器并添加了配置文件,我不必使用'-P'或'-firefoxProfileTemplate'指定配置文件。我只需在Jenkins的浏览器框中指定'* firefox'就足够了>> SeleniumHQ设置 – 2014-12-10 11:52:23

+0

真正有用的Selenium Server命令行选项[链接] http://eswarg.blogspot.com.tr/2013/06/selenium -server-命令行,options.html – 2014-12-10 11:56:38