Hasan Abbas
Hasan Abbas

Reputation: 23

Jenkins - Cucumber tests integration - Failed to instantiate class base.StepDef

I have been running the Cucumber tests on my system successfully. The tests I write are being managed in Bitbucket. My new task includes integration of Jenkins with our Cucumber tests. I have tried this by following several tutorials available online and by going through a number of related questions here on stackoverflow. Almost all those tutorials work with locally installed Jenkins servers on Windows but my Jenkins server is running on a remote CentOS 7 server. The error that I am facing consistently is: cucumber.runtime.CucumberException: Failed to instantiate class base.PageStepDef.

I am using IntelliJ IDE and I run the tests using mvn clean test -Dcustomer="iapps" -Denv="stage" -Dbrowser="chrome" in command prompt after moving to the root folder of the project. My POM file is at the root of the project while StepDef and RunTest are at src/test/java/base/PageStepDef.java

On Jenkins, I have tried with both Free Style Project and Maven Project but none of them are working. One difference that I have noticed is on my local system the Chrome Driver version is 83.0.4103.39 while Jenkins is using ChromeDriver 2.46.628388. But I am not sure if there is a need to update this Chrome Driver for Jenkin's job too. And if yes, how? Can anyone please help solve this issue?

My objective is to run the tests headlessly and I hope there is a solution to this.

Here is the POM file:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>iapps-admin-portal</groupId>
  <artifactId>iapps-admin-portal</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>4.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-safari-driver</artifactId>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-ie-driver</artifactId>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.14.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <type>maven-plugin</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.lazerycode.selenium</groupId>
                <artifactId>driver-binary-downloader-maven-plugin</artifactId>
                <version>1.0.17</version>
                <configuration>

     <rootStandaloneServerDirectory>${project.basedir}/src/test/resources/webdrivers/ 
            selenium_standalone_binaries</rootStandaloneServerDirectory>

  <downloadedZipFileDirectory>${project.basedir}/src/test/resources/webdrivers/ 
    selenium_standalone_zips</downloadedZipFileDirectory>

   <customRepositoryMap>${project.basedir}/src/test/resources/RepositoryMap.xml</customRepositoryMap>
                    <overwriteFilesThatExist>false</overwriteFilesThatExist>
                    <onlyGetDriversForHostOperatingSystem>true</onlyGetDriversForHostOperatingSystem>
                    <operatingSystems>
                        <windows>true</windows>
                        <linux>true</linux>
                        <mac>true</mac>
                    </operatingSystems>
                    <sixtyFourBitBinaries>true</sixtyFourBitBinaries>

    <throwExceptionIfSpecifiedVersionIsNotFound>true</throwExceptionIfSpecifiedVersionIsNotFound>
                    <fileDownloadRetryAttempts>3</fileDownloadRetryAttempts>
                    <fileDownloadConnectTimeout>40000</fileDownloadConnectTimeout>
                    <fileDownloadReadTimeout>30000</fileDownloadReadTimeout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>selenium</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>5.0.0</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>test</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <projectName>ReportAutomation</projectName>
                            <!-- output directory for the generated report -->
                <outputDirectory>${project.build.directory}/ cucumber-reports</outputDirectory>
                            <!-- optional, defaults to outputDirectory if not specified -->
                            <inputDirectory>${project.build.directory}/</inputDirectory>
                            <jsonFiles>
                                <!-- supports wildcard or name pattern -->
                                <param>**/*.json</param>
                            </jsonFiles>
                            <!-- optional, defaults to outputDirectory if not specified -->

                  <classificationDirectory>${project.build.directory}/</classificationDirectory>
                            <classificationFiles>
                                <!-- supports wildcard or name pattern -->
                                <param>sample.properties</param>
                                <param>other.properties</param>
                            </classificationFiles>
                            <checkBuildResult>true</checkBuildResult>
                            <mergeFeaturesWithRetest>true</mergeFeaturesWithRetest>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Here is the console output of Maven Project (which appears similar to the above):



         Running as SYSTEM
            [EnvInject] - Loading node environment variables.
            Building on master in workspace /var/lib/jenkins/workspace/CucumberTest-Maven
            using credential jenkins
             > git rev-parse --is-inside-work-tree # timeout=10
               Fetching changes from the remote Git repository
             > git config remote.origin.url ssh://[email protected]:1234/iap/ 
                iapps-automation-admin-portal.git # timeout=10
                Fetching upstream changes from ssh://[email protected]:1234/iap/
                iapps-automation-admin-portal.git
             > git --version # timeout=10
            using GIT_SSH to set credentials 
             > git fetch --tags --force --progress -- ssh://[email protected]:1234/iap/
                iapps-automation-admin-portal.git +refs/heads/*:refs/remotes/origin/* # timeout=10
             > git rev-parse refs/remotes/origin/auto_test^{commit} # timeout=10
             > git rev-parse refs/remotes/origin/origin/auto_test^{commit} # timeout=10
                 Checking out Revision ed379b3b59f4173aa5a768de5b1ea1e55a980a98 
                 (refs/remotes/origin/auto_test)
             > git config core.sparsecheckout # timeout=10
             > git checkout -f ed379b3b59f4173aa5a768de5b1ea1e55a980a98 # timeout=10
             Commit message: "another minor change in pom file"
             > git rev-list --no-walk ed379b3b59f4173aa5a768de5b1ea1e55a980a98 # timeout=10
               Parsing POMs
               Established TCP socket on 36183
               [CucumberTest-Maven] $ /bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/
                maven35-agent- 1.13.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation
                /mvn_3.6.1/boot/plexus-classworlds-2.6.0.jar:/var/lib/jenkins/tools/
                hudson.tasks.Maven_MavenInstallation/mvn_3.6.1/conf/
                logging jenkins.maven3.agent.Maven35Main 
                /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/mvn_3.6.1 
                /var/cache/jenkins/war/WEB-INF/lib/remoting-4.2.1.jar 
                /var/lib/jenkins/plugins/maven-plugin/
                WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/
                WEB-INF/lib/maven3-interceptor-commons-1.13.jar 36183
            <===[JENKINS REMOTING CAPACITY]===>channel started
            Executing Maven:  -B -f /var/lib/jenkins/workspace/CucumberTest-Maven/
                pom.xml clean test -Dcustomer=iapps -Denv=stage -Dbrowser=chrome
            [INFO] Scanning for projects...
            [INFO] 
            [INFO] ---------------< iapps-admin-portal:iapps-admin-portal >----------------
            [INFO] Building iapps-admin-portal 0.0.1-SNAPSHOT
            [INFO] --------------------------------[ jar ]---------------------------------
            [INFO] 
            [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ iapps-admin-portal ---
            [INFO] Deleting /var/lib/jenkins/workspace/CucumberTest-Maven/target
            [INFO] 
            [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ iapps-admin-portal ---
            [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, 
                i.e. build is platform dependent!
            [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/
                CucumberTest-Maven/src/main/resources
            [INFO] 
            [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ iapps-admin-portal ---
            [INFO] No sources to compile
            [INFO] 
            [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) 
            @ iapps-admin-portal ---
            [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, 
                i.e. build is platform dependent!
            [INFO] Copying 12 resources
            [INFO] 
            [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) 
                  @ iapps-admin-portal ---
            [INFO] Changes detected - recompiling the module!
            [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. 
                build is platform dependent!
            [INFO] Compiling 10 source files to /var/lib/jenkins/workspace/CucumberTest-Maven/
            target/test-classes
            [WARNING] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/handler/
                SelectHandler.java:[4,49] com.sun.org.apache.xpath.internal.objects.XString is 
                internal proprietary API and may be removed in a future release
            [WARNING] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/
                      handler/SelectHandler.java:        
            [5,49] com.sun.org.apache.xpath.internal.objects.XStringForChars is internal proprietary API 
                and may be removed in a future release
            [WARNING] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/handler/
                SelectHandler.java:[11,17] sun.swing.SwingAccessor is internal proprietary API and may 
                be removed in a future release
            [WARNING] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/handler/
                AssertHandler.java:[7,38] com.sun.imageio.plugins.common.ReaderUtil is 
                internal proprietary 
                API and may be removed in a future release
            [INFO] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/base/PageStepDef.java:         
             /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/base/PageStepDef.java 
                uses or overrides a deprecated API.
            [INFO] /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/java/base/PageStepDef.java: 
                Recompile with -Xlint:deprecation for details.
            [INFO] 
            [INFO] --- driver-binary-downloader-maven-plugin:1.0.17:selenium (default) 
            @ iapps-admin-portal ---
            [INFO]  
            [INFO] --------------------------------------------------------
            [INFO]  DOWNLOADING SELENIUM STAND-ALONE EXECUTABLE BINARIES...
            [INFO] --------------------------------------------------------
            [INFO]  
            [INFO] Repository map 'file:/var/lib/jenkins/workspace/
                CucumberTest-Maven/src/test/resources/RepositoryMap.xml' is valid
            [INFO]  
            [INFO] Only get drivers for current Operating System: true
            [INFO] Getting drivers for current operating system only.
            [INFO] Archives will be downloaded to '/var/lib/jenkins/workspace/
                CucumberTest-Maven/src/test/resources/webdrivers/selenium_standalone_zips'
            [INFO] Standalone executable files will be extracted to '/var/lib/jenkins/workspace/
                CucumberTest-Maven/src/test/resources/webdrivers/selenium_standalone_binaries'
            [INFO]  
            [INFO] Preparing to download Selenium Standalone Executable Binaries...
            [INFO] Binary 'geckodriver' exists: true
            [INFO] Using existing 'geckodriver 'binary.
            [INFO] Binary 'chromedriver' exists: true
            [INFO] Using existing 'chromedriver 'binary.
            [INFO] Setting maven property - ${webdriver.gecko.driver} = 
             /var/lib/jenkins/workspace/CucumberTest-Maven/src/test/resources/webdrivers/ 
            selenium_standalone_binaries/linux/marionette/64bit/geckodriver
            [INFO] Setting maven property - ${webdriver.chrome.driver} = 
             /var/lib/jenkins/workspace/CucumberTest-                        
             Maven/src/test/resources/webdrivers/selenium_standalone_binaries/linux/
                googlechrome/64bit/chromedriver
            [INFO]  
            [INFO] --------------------------------------------------------
            [INFO] SELENIUM STAND-ALONE EXECUTABLE DOWNLOADS COMPLETE
            [INFO] --------------------------------------------------------
            [INFO]  
            [INFO] 
            [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ iapps-admin-portal ---
            [INFO] Surefire report directory: /var/lib/jenkins/workspace/CucumberTest-Maven/
                target/surefire-reports

            -------------------------------------------------------
             T E S T S
            -------------------------------------------------------
            Running base.RunITTest
            Customer: iapps
            Loaded Config: /var/lib/jenkins/workspace/CucumberTest-Maven/configurations/data/
                iapps-stage-data.properties
            Customer: iapps
            Loaded Config: /var/lib/jenkins/workspace/CucumberTest-Maven/configurations/elements/
                iapps-elements.properties
            Customer: iapps
            Loaded Config: /var/lib/jenkins/workspace/CucumberTest-Maven/configurations/asserts/
                iapps-asserts.properties
            Browser: chrome
            Starting ChromeDriver 2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926) on port 26512
            Only local connections are allowed.
            Please protect ports used by ChromeDriver and related test frameworks to prevent access by 
                malicious code.
            Browser: chrome
            Starting ChromeDriver 2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926) on port 25905
            Only local connections are allowed.
            Please protect ports used by ChromeDriver and related test frameworks to prevent access by 
                malicious code.
            Feature: Perform groups listing and creation

              Background:                                                                                            
                src/test/resources/features/UserManagment/Groups.feature:
                Given I open the url login.url
                PageStepDef.openUrl(String)[0m
                  cucumber.runtime.CucumberException: Failed to instantiate class base.PageStepDef
                at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance
                (DefaultJavaObjectFactory.java:47)
                at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance
              (DefaultJavaObjectFactory.java:33)
                at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:49)
                at cucumber.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:50)
                at cucumber.runner.TestStep.executeStep(TestStep.java:63)
                at cucumber.runner.TestStep.run(TestStep.java:49)
                at cucumber.runner.PickleStepTestStep.run(PickleStepTestStep.java:43)
                at cucumber.runner.TestCase.run(TestCase.java:44)
                at cucumber.runner.Runner.runPickle(Runner.java:40)
                at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:146)
                at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
                at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
                at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
                at cucumber.api.junit.Cucumber.runChild(Cucumber.java:124)
                at cucumber.api.junit.Cucumber.runChild(Cucumber.java:65)
                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
                at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:133)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
                at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet
                   (JUnit4Provider.java:141)
                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray
               (ReflectionUtils.java:189)
                at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.
                invoke(ProviderFactory.java:165)
                at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider
                   (ProviderFactory.java:85)
                at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess
                   (ForkedBooter.java:115)
                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
                    Caused by: java.lang.reflect.InvocationTargetException
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance
               (NativeConstructorAccessorImpl.java:62)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
                (DelegatingConstructorAccessorImpl.java:45)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                at cucumber.runtime.java.DefaultJavaObjectFactory.
                cacheNewInstance(DefaultJavaObjectFactory.java:41)
                ... 39 more
               Caused by: org.openqa.selenium.WebDriverException: 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.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),
                platform=Linux 3.10.0-1062.7.1.el7.x86_64 x86_64) (WARNING: The server did not provide 
                any stacktrace information)
                Command duration or timeout: 172 milliseconds
                Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
                System info: host: 'jenkins', ip: '192.168.1.219', os.name: 'Linux', os.arch: 'amd64', 
                os.version: '3.10.0-1062.7.1.el7.x86_64', java.version: '1.8.0_232'
                Driver info: driver.version: ChromeDriver
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance
                (NativeConstructorAccessorImpl.java:62)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
                (DelegatingConstructorAccessorImpl.java:45)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
                at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
                at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0
                (JsonWireProtocolResponse.java:53)
                at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda
                $getResponseFunction$2(JsonWireProtocolResponse.java:91)
                at org.openqa.selenium.remote.ProtocolHandshake.lambda$
                createSession$0(ProtocolHandshake.java:122)
                at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
                at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
                at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
                at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
                at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
                at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
                at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
                at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
                at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
                at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
                at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
                at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
                at org.openqa.selenium.remote.service.DriverCommandExecutor.execute
                (DriverCommandExecutor.java:83)
                at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
                at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
                at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
                at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
                at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
                at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
                at base.PageStepDef.<init>(PageStepDef.java:57)
                ... 44 more
    ```

Here are the settings that I am using to build **Free Style Project** :

[Build Settings for Free Style Project in Jenkins][1]
<br>Here are the settings that I am using to build **Maven Project** :
[Build Settings for Maven Project in Jenkins][2]
<br>Here is the console output of Free Style project :
[enter image description here][3]


  [1]: https://i.sstatic.net/bRDnr.png
  [2]: https://i.sstatic.net/AknqS.png
  [3]: https://i.sstatic.net/FYQ1t.png

Upvotes: 2

Views: 1140

Answers (1)

UnknownBeast
UnknownBeast

Reputation: 979

There could be the multiple root cause. First solution is to add the below code in your script

chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

If above doesn't work then you will have to check the compatibility of chromedriver with the chrome browser present in the Jenkins Node.

For Older Version:

chromedriver    chrome
2.46            71-73
2.45            70-72
2.44            69-71
2.43            69-71
2.42            68-70
2.41            67-69
2.40            66-68
2.39            66-68
2.38            65-67
2.37            64-66
2.36            63-65
2.35            62-64
2.34            61-63
2.33            60-62
---------------------
2.28            57+
2.25            54+
2.24            53+
2.22            51+
2.19            44+
2.15            42+

For Latest Chrome Browsers

If you are using Chrome version 84, please download ChromeDriver 84.0.4147.30
If you are using Chrome version 83, please download ChromeDriver 83.0.4103.39
If you are using Chrome version 81, please download ChromeDriver 81.0.4044.69
If you are using Chrome version 80, please download ChromeDriver 80.0.3987.106
If you are using Chrome version 79, please download ChromeDriver 79.0.3945.36
If you are using Chrome version 78, please download ChromeDriver 78.0.3904.105
If you are using Chrome version 77, please download ChromeDriver 77.0.3865.40
If you are using Chrome version 76, please download ChromeDriver 76.0.3809.126
If you are using Chrome version 75, please download ChromeDriver 75.0.3770.140
If you are using Chrome version 74, please download ChromeDriver 74.0.3729.6
If you are using Chrome version 73, please download ChromeDriver 73.0.3683.68

And at the end, If above solutions does not work then you can implement selenium grid and then you do the execution of your test scripts.

Upvotes: 1

Related Questions