2016-03-11 14 views
5

FreeBSDサーバーでJenkinsでプレーフレームワークテストを実行すると、Error: no display specifiedが発生します。 だから私が直面するたびにタイムアウトとJenkinsとヘッドレスFirefox Xvfbでセレンテストを実行する

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox

ジェンキンスあります

1)Xvfbのプラグイン

2をインストール)フレームワークは

テストは、セレン化ライブラリやセレンを使用して書かれているインストール再生プレイフレームワークのためのモジュール。

Xvfbがジョブ設定で設定され、有効になっています。

ジョブのコンソール出力です:

Checking out Revision 3f485bd2e3dbcfa058fc19f89ab18020e36707d8 (origin/trunk) 
... 
Xvfb starting$ /usr/local/bin//Xvfb :1 -screen 0 -fbdir /usr/local/jenkins/xvfb-9-786185694297443042.fbdir 
... 
Command detected: clean 
Command detected: deps --sync 
Command detected: precompile 
Command detected: auto-test 
[YalsTests] $ /srv/java/play/play clean 
... 
~ using java version "1.8.0_72" 
[YalsTests] $ /srv/java/play/play auto-test 
~ 14 tests to run: 
~ 
~ selenium/front/CorrectInput...   org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: 
Error: no display specified 

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:113) 
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271) 

ジョブ構成:

[X] Start Xvfb before the build, and shut it down after. 
Xvfb specific display name 1 
Xvfb display name offset 0 

Invoke Play Framework  
Command set  Play 1.x 
Goals 
    Clean project [clean] 
    Custom parameter 
     Custom command deps --sync 
    Precompile all Java sources and templates [precompile] 
    Automatically run all application tests [auto-test] 

答えて

1

セレンタスクは、それがに接続しなければならないという表示を知っている必要があります。 設定できます。環境変数

export DISPLAY=:10 

これはbashのためにある、他のシェルは、2段階のプロセスが必要になる場合があります(あなたは.profileファイルであることを行う場合には、それをエクスポートすることを忘れないでください)のように:

DISPLAY=:10 
export DISPLAY 

ますあなたはSelenoidプロジェクトを使用して、すべてのこれらの問題を避けることができ

DISPLAY=:10 java -jar mySelenium.jar 
0

に並行して、ヘッドレスブラウザを起動します。また、コマンドの前に、コマンドラインで変数を指定することができます3210コンテナ。コンテナイメージは、Webdriverとブラウザの互換バージョンを考慮して作成されます。彼らはまた、フォント、flashplayerなどが含まれています。すでに存在するimagesのいずれかを選択し、テストを実行してください。 Seleniumテストを実行するためにJavaをインストールする必要はありません。

関連する問題