Forum Discussion

rezza's avatar
Occasional Contributor
4 years ago

run cucumber selenium tests in gitlab-ci

I have a selenium cucumber project with some tests.

The tests worked and the chromeDriver had launch when I run the -mvn clean compile test in my IDE.

I created this .gitlab-ci.yml in my project's root:

image: markhobson/maven-chrome:jdk-11

  - build
  - test

  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"

    - .m2/repository/
    - target/

  stage: build
    - mvn $MAVEN_OPTS clean package
    - mvn compile

  stage: test
    - mvn test

When I run the pipeline, I face this error in the console:

Unable to load browser: Could not start a new session.
Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '4.0.0-beta-1', revision: '9c03156c2b'
System info: host: 'runner-fa6cab46-project-25183469-concurrent-0', ip: '', 'Linux', os.arch: 'amd64', os.version: '4.19.78-coreos', java.version: '11.0.10'
Driver info:

What can I do for running the tests?

16 Replies

  • So what is happening here is google chrome is crashing during the run.


    Chrome uses /dev/shm for runtime data which is 64MB by default under Docker. If this is not sufficient then this can cause Chrome to crash . Possible workarounds:

    • Increase the size of /dev/shm
    • Mount /dev/shm to the host's
    • Start Chrome with the flag --disable-dev-shm-usage
  • Hi,


    You're gitlab-ci.yml looks good


    Can you provide more logs of your pipeline?

    Do you properly run chrome in headless mode?


            ChromeOptions options = new ChromeOptions();
            driver = new ChromeDriver(options);


    • rezza's avatar
      Occasional Contributor


      Thanks for replying.

      What is needed to providing?

      May I give all the pipeline's output?

      This is my file which has the driver configurations.

      And This is that file after adding the chromeDriver headLess option.

      As you can see, I added the chromeDriver headLess option.


      Before adding, everything is worked in IDE mode.

      But when I add the chromeDriver headLess option, I face this error in the testNG's report:

      feature (Login into account)
      cucumber.runtime.CucumberException: java.lang.AssertionError: Unable to wait and click on the WebElement, using locator: <Proxy element for: DefaultElementLocator 'By.linkText: Sign in'>
      	at cucumber.api.testng.TestNGCucumberRunner.runCucumber(
      	at cucumber.api.testng.AbstractTestNGCucumberTests.feature(
      Caused by: java.lang.AssertionError: Unable to wait and click on the WebElement, using locator: <Proxy element for: DefaultElementLocator 'By.linkText: Sign in'>
      	at pageObjects.BasePage.waitAndClickElement(
      	at pageObjects.Login_page.clickOnSignInButton(
      	at stepDefinitions.LoginSteps.user_clicks_on_the_login_button_on_homepage(
      	at ✽.And User clicks on the login button on homepage(Login.feature:6)
      ... Removed 28 stack frames
      (Runs Cucumber Feature)


      I didn't run the test in GitLab mode. because first, I want to solve the problem in IDE mode.

      I'm so new, please guide me.

      Thanks in advanced.

      • For better readability, could you paste your code in the forum using the "insert code sample" snippet instead of


        And I suggest you run your tests not in headless mode in your IDE. Maybe something is actually failing but as it is in Headless mode, you can not see it.


        Can you remove the code about Firefox and IE to make it cleaner and easier to debug?