簡體   English   中英

Jenkins和Seleniumhq配置

[英]Jenkins and Seleniumhq configuration

我正試圖在Jenkins中設置一個簡單的Selenium測試。 我的操作系統是Debian GNU / Linux 6.0.7(擠壓),桌面版(64位)。 我卸載了提供的瀏覽器iceweasel並使用aptitude安裝了Firefox。 firefox版本是“20.0”。 我也安裝了Google Chrome。 我可以通過在終端窗口中編寫“firefox”來運行Firefox。 Jenkins安裝了aptitude。

所以,我在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 / usr / bin / firefox我認為firefox安裝在那里(我運行“locate 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 
....

有沒有人有關於如何解決這個問題的想法? 謝謝!

編輯

我將瀏覽器設置更改為:* 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”一樣輸入。

http://alex.nederlof.com/blog/2012/11/19/installing-selenium-with-jenkins-on-ubuntu/

您應該嘗試從shell運行命令行,看看會發生什么。 這肯定是與selenium實例化的firefox使用的默認配置文件相關聯的問題。

在我的情況下,問題是firefox首先顯示可以恢復的選項卡。

您還可以嘗試創建特定的配置文件: firefox -pfirefox -ProfileManager

然后使用命令行參數使用此專用配置文件:
-firefoxProfileTemplate /home/userXXX/.mozilla/firefox/ljhyckqd.Selenium

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

語法錯誤。 嘗試* firefox或* firefox [插入目錄]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM