Ubuntu-Ubuntu中的Jenkins和GIT, 使用硒的Java项目
尝试在Jenkins(带有Agent节点的Jenkins)中运行GIT项目。
詹金斯错误
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-39-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 254 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'WebTest-VM', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-39-generic', java.version: '1.8.0_191'
Driver info: driver.version: ChromeDriver
注意:相同的Java + Selenium项目能够在本地计算机上打开chrome浏览器
System.setProperty("webdriver.chrome.driver", "/home/webtest/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();
答案 0 :(得分:0)
尝试将JenkinsFile
添加到项目中并提交到git
您的JenkinsFile
可能具有以下语法:
pipeline {
agent any
tools {
maven 'maven_3_5_0'
}
stages {
stage('Checkout Code from Git') {
steps {
git 'https://github.com/xxxxxxx/your-project.git'
}}
stage('compile stage') {
steps {
bat "mvn clean compile"
}
}
stage('testing stage') {
steps {
bat "mvn test"
}
}
}
}
答案 1 :(得分:0)
在Windows Server 2012上,只需下载适合您的Chrome版本的chromedriver。
对于所有用户,将该驱动程序放在公共位置。例如在驱动器C:\Tools\Chromedriver
中。然后在您的Jenkins实例中,只需使用该驱动程序的路径更新env变量即可。