1

Ubuntu - Jenkins and GIT in Ubuntu, Java project using selenium

Trying to run GIT project in Jenkins(Jenkins with Agent node).

Error in Jenkins

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

Note: Same java + Selenium project able to open chrome browser in local machine

System.setProperty("webdriver.chrome.driver", "/home/webtest/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();
xxxvodnikxxx
  • 1,270
  • 2
  • 18
  • 37
Pooja Patange
  • 47
  • 1
  • 10
  • I found a solution for above issue my answer may help others change chrome driver path to public static String chromeDriverPath = "/usr/bin/chromedriver"; System.setProperty("webdriver.chrome.driver", chromeDriverPath); WebDriver driver = new ChromeDriver(); Fallowed below tutorial solved my all problems. http://stgconsulting.com/running-automated-selenium-tests-from-jenkins-on-linux/ – Pooja Patange Nov 28 '18 at 13:44

2 Answers2

0

Try adding JenkinsFile to your project and commit to git

enter image description here

Your JenkinsFile could have following syntax:

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"
        }
    }

  }

}
Kushal Bhalaik
  • 3,349
  • 5
  • 23
  • 46
  • 1
    Dear kushal Jenkinsfile is text file ? – Pooja Patange Nov 21 '18 at 11:27
  • im getting chrome failure to open browser can you please recheck my above post – Pooja Patange Nov 26 '18 at 12:55
  • Please try and keep `chromedriver.exe` in your project itself under resources or so. Then insted of path like this `/home/webtest/Downloads/chromedriver` use relative path to chromedriver something like `src/test/res/chromedriver.exe` – Kushal Bhalaik Nov 27 '18 at 10:09
  • IM using Ubuntu OS - within local system codes are working fine and when i'm trying to run in Jenkins(Jenkins in server) getting above issue. – Pooja Patange Nov 27 '18 at 10:41
  • try solutions mentioned here : https://stackoverflow.com/questions/22558077/unknown-error-chrome-failed-to-start-exited-abnormally-driver-info-chromedri – Kushal Bhalaik Nov 27 '18 at 10:54
  • 1
    I found a solution for above issue my answer may help others change chrome driver path to public static String chromeDriverPath = "/usr/bin/chromedriver"; System.setProperty("webdriver.chrome.driver", chromeDriverPath); WebDriver driver = new ChromeDriver(); Fallowed below tutorial solved my all problems. http://stgconsulting.com/running-automated-selenium-tests-from-jenkins-on-linux/ – Pooja Patange Nov 28 '18 at 13:37
0

On Windows Server 2012, just download the chromedriver suitable for your Chrome version. Put that driver in common place for all users. In Drive C:\Tools\Chromedriver for example. Then in your Jenkins instance, just update the env variables with the path to that driver.