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.