Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins和Seleniumhq构型_Selenium_Jenkins_Debian_Selenium Rc - Fatal编程技术网

Jenkins和Seleniumhq构型

Jenkins和Seleniumhq构型,selenium,jenkins,debian,selenium-rc,Selenium,Jenkins,Debian,Selenium Rc,我想在詹金斯做一个简单的硒测试。我的操作系统是Debian GNU/Linux 6.0.7(挤压),桌面版(64位)。我卸载了提供的浏览器iceweasel,并用aptitude安装了Firefox。firefox版本是“20.0”。我还安装了谷歌浏览器。我可以通过在终端窗口中写入“Firefox”来运行Firefox。 詹金斯有天赋 因此,我在Jenkins中安装了一个名为Seleniumhq的插件。以下是我的设置: 然后,当我尝试构建时,我在Jenkins控制台中收到一个错误: Start

我想在詹金斯做一个简单的硒测试。我的操作系统是Debian GNU/Linux 6.0.7(挤压),桌面版(64位)。我卸载了提供的浏览器iceweasel,并用aptitude安装了Firefox。firefox版本是“20.0”。我还安装了谷歌浏览器。我可以通过在终端窗口中写入“Firefox”来运行Firefox。 詹金斯有天赋

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

然后,当我尝试构建时,我在Jenkins控制台中收到一个错误:

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 org.openqa.jetty.jetty.servlet.ServletHandler@488e32e7
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 org.openqa.jetty.jetty.Server@5a5e5a50
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
有人知道如何解决这个问题吗? 谢谢

编辑

我将浏览器设置更改为: *firefox/opt/firefox/firefox(中间有空格) 现在似乎可以找到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 org.openqa.jetty.jetty.servlet.ServletHandler@3da99561
 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 org.openqa.jetty.jetty.Server@182d9c06
 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

嗯,我发现了一个很好的教程,结果证明很有用。一件重要的事情是在服务器上启动一个虚拟X窗口,Selenium可以在其中启动浏览器来运行测试(Xvfb)。在Jenkins中,服务器应该像“firefox”一样输入


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

您应该尝试从shell运行命令行,看看会发生什么。这当然是一个与selenium实例化的firefox使用的默认配置文件有关的问题

在我的例子中,问题是firefox从显示可以恢复的选项卡开始

您还可以尝试创建特定的配置文件:
firefox-p
firefox-ProfileManager

然后使用命令行参数使用此专用配置文件:

-firefoxProfileTemplate/home/userXXX/.mozilla/firefox/ljhyckqd.Selenium

尝试使用Export语句将firefox 20.0路径添加到类路径。您的意思是在Jenkins系统配置中?应该在何处执行此操作?在运行selenium脚本的系统终端中运行以下命令<代码>导出类路径=%path%;firefox二进制文件的路径,但我不是在终端中运行它,而是在Jenkins中运行它…Jenkins拥有终端,添加step shell execute。这个解决方案在Debian 3.2.0-4-amd64上运行firefox,从这个Repo:deb Debian导入。但是,一旦我从命令提示符运行概要文件管理器并添加概要文件,我就不必使用
-P
-firefoxProfileTemplate
指定概要文件。我只需在Jenkins>>SeleniumHQ设置中的浏览器框中指定
*firefox
,就足够了。SeleniumHQ设置非常有用的Selenium服务器命令行选项[link]
 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 org.openqa.jetty.jetty.servlet.ServletHandler@3da99561
 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 org.openqa.jetty.jetty.Server@182d9c06
 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
java.lang.RuntimeException: Browser not supported: *firefox/usr/bin/firefox