I am using mvn test command to run selenium test cases using chrome and chrome driver with same versions on ubuntu 20.04. When I run mvn test command in terminal it works fine in the directory build was successful. When I run mvn test command in jenkins pipeline it gives me error.
> [ERROR] initialization(LogInCases) Time elapsed: 2.525 s <<<
> FAILURE! org.openqa.selenium.SessionNotCreatedException: Could not
> start a new session. Response code 500. Message: unknown error: Chrome
> failed to start: crashed. (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.)
My jenkins pipeline stage command is
sh 'cd home/useradmin/files/ && mvn test'
How to fix this so that I can get the same result in a machine terminal as in jenkins pipeline.
Is your Jenkins agent the same machine where you performed the tests using the command line?
If not, please test on the Jenkins agent machine using the command line.
On your local machine, do you have the webdriver.chrome.driver environment variable defined?
Yes Jenkins is running on the same machine where i am performing the task. Yes i have installed chrome driver but unable to set environment variable can you help me?