Getting Error while running Selenium + Java + Maven tests in Gitlab CI/CD pipeline

I have created a new project in GITLAB and pushed the code(Selenium using Java and Maven) to the repository. Then I created a yml file to run the maven tests.

Then code runs and I am getting below error -

java.lang.IllegalStateException: The driver is not executable: /builds/testqaaccount/dummytestproject/Drivers/chromedriver.exe

1 Like

Good afternoon ! Did you solve this problem?

Hi, In order to solve this problem you can use below in your .yml file

services:

  • name: selenium/standalone-chrome:latest
    alias: gitlab-selenium-server

In code you can use below and instead of initializing the new ChromeDriver(); you can initialize the RemoteWebDriver
http://selenium__standalone-chrome:4444/wd/hub/

1 Like

I have tests written in Java + Maven + SeleniumWEBDriver + Cucumber, they run on Eclipse, how should I create this YML file?

Ok. If you are running on Gitlab CI/CD then you can add a file named .gitlab-ci.yml which can be placed at the root of project. This file read by GitLab CI runner and execute whenever any commit happens into repo. Example of this file can be seen on to net.
https://docs.gitlab.com/ce/ci/yaml/README.html#cache

1 Like

Thank you ! Would you have any models of this file with this implementation of Java + Junit + Selenium + Cucumber? I have already created this YML file, but I don’t know what to put into it, I’m not a developer, I’m of quality. If you could help me, I would be very grateful.

Hi Atul, can you please share that yml file that you created for your Selenium Java maven project. Thanks