2
votes

I've been trying to run selenium codes over Jenkins (server/openshift). There is chrome node in the jenkins machine for Test Automation - Selenium. I'm getting this error:

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally

Test ll work on chrome node jenkins-openshift. So I don't need to set browser type as headless, besides If I set browser type as headless, It can't find any UI component of our application. By the way, I developed this code by using cucumber/gherkin.

It works on local via maven clean-verify.

This is our jenkins file to run automated UI test on jenkins:

    stage('scm checkout') {
        echo '****************************************\r*** scm checkout'
        checkout scm
        echo '*** show content ***'
        sh "ls -lA"
    }

    stage('build artifact') {
        echo '****************************************\r*** Build Artifact'
        sh "mvn -V -B clean package"
    }

    stage('selenium GUI test') {
            echo '****************************************\r*** Selenium GUI Test'
            sh "mvn -V -B clean verify"
        }
}

This is related part of pom.xml:

<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-failsafe-plugin</artifactId>
                <version>2.18.1</version>
                <executions>
                    <execution>
                        <configuration>
                            <forkCount>3</forkCount>
                            <reuseForks>true</reuseForks>
                            <encoding>UTF-8</encoding>
                            <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                            <testFailureIgnore>true</testFailureIgnore>
                            <includes>
                                <includesFile>**/*UITestsRunner.java</includesFile>
                            </includes>
                        </configuration>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>3.8.0</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <projectName>testing</projectName> 

                            <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                            <cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
                            <buildNumber>1</buildNumber>
                            <parallelTesting>false</parallelTesting>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

Additionally, this is webdriver settings part of the code :

            ChromeOptions options = new ChromeOptions();
            options.addArguments("--no-sandbox"); //Bypass OS security model
            options.addArguments("--disable-web-security");
            options.addArguments("--ignore-urlfetcher-cert-requests");
            //options.addArguments("--disable-renderer-backgrounding");
            options.addArguments("--disable-infobars"); //Disabling infobars
            //options.addArguments("--start-maximized"); //Open Browser in maximized mode
            options.addArguments("--disable-dev-shm-usage"); //Overcome limited resource problem
            options.setExperimentalOption("useAutomationExtension", false);
            options.addArguments("--log-level=3"); // set log level
            options.addArguments("--silent");
            options.addArguments("--disable-gpu");
            options.addArguments("window-size=1920,1080");
            webDriver = new ChromeDriver(options);

There is no issue on local, but on the server, I've been getting this error:

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=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 3.10.0-957.10.1.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 287 milliseconds Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z' System info: host: 'jenkins-agent-blue-1', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.10.1.el7.x86_64', java.version: '1.8.0_192' 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:215) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167) 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$24(ProtocolHandshake.java:359) 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:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) 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:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:254) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:178) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:167) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:156)

I use Chrome (version 73) and ChromeDriver (version 73.0.3683.68) in local as same in chrome node (jenkins).

1

1 Answers

0
votes

Add options.addArguments("--remote-debugging-port=9222");