The web browser doesn't show while run selenium test via jenkins
原因:因為jenkins是用windows installer 安裝成 windows的服務了,那么jenkins是一個后臺服務,所以跑selenium cases 的時候不顯示瀏覽器
解決辦法:
Step 1. Control Panel(控制面板) -> Administrative Tools(管理工具) -> Services(服務)
找到Jenkins,右鍵菜單,執(zhí)行stop; 右鍵菜單 “屬性” start type 選擇“Disabled” 點擊 應用,點擊確定。(這一步目的:讓jenkins不在以windows 服務的方式在后臺運行)
Step2. 通過命令行啟動Jenkins
java -jar "D:Program Files (x86)Jenkinsjenkins.war"
當然,大家也可以做個bat文件,以后每次啟動jenkins,雙擊運行這個bat文件OK了,bat文件內容如下:
echo "Jenkins CI automation testting"
java -jar "D:Program Files (x86)Jenkinsjenkins.war"
pause
Step3. 重新創(chuàng)建Jenkins的Job,重新配置,在執(zhí)行測試
問題解決了。
注意問題:
(1)通過這種方式啟動jenkins,之前以windows service 啟動jenkins的數(shù)據(jù)都丟失了,需要重新創(chuàng)建job。
。2)之前以windows service 啟動jenkins中安裝的插件也沒有了,需要重新安裝所需插件。
其他參考:
If you run Jenkins as a service in the background it won't open apps in the foreground. You may either try to run it not as a service in the foreground, or run it as a Local System account and check Allow the service to interact with desktop option. In the latter case you may get into permission problems, though.