0

I am only starting to use GitLab as CI tool. I have created autotests using stack: Java, Cucumber, Maven. I have created gitlab-ci.yml with next settings:

image: maven:latest
stages:
  - test
test:
  stage: test
  script:
    - mvn clean test -Dtest=RunCucumberTest

yml example

But Pipeline is failed with next errors:

 java.lang.IllegalStateException: The driver is not executable: /builds/<user>/cucumber-testing/./src/drivers/chromedriver_99.exe
    at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:150)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141)
    at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
    at seleniumActions.ActionWithElement.setUp(ActionWithElement.java:24)
    at stepDefinition.Hooks.setUp(Hooks.java:14)

How do I set up ChromeDriver for gitlab in my .yml file?

Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
tester
  • 95
  • 1
  • 7
  • IS `/builds//cucumber-testing/./src/drivers/chromedriver_99.exe` executable? My guess is that that path does not exist, and it is that "" component of the path that is the problem. Is that an actual directory name? I'm assuming not. If not, then it appears that something was supposed to have expanded "" to the something else in that path, but failed to. – CryptoFool Mar 09 '22 at 19:08
  • Which operating system is your job running on? Remember you can't execute windows executables on Unix. – M.P. Korstanje Mar 09 '22 at 19:12
  • I can not understand exactly where this path to .exe file was generated. In my project 'chromedriver_99.exe' file is located on './src/drivers/chromedriver_99.exe' path. https://share.getcloudapp.com/xQuqegyJ When I run test from IDE - everything is ok – tester Mar 09 '22 at 19:13
  • I am running on Windows 10 – tester Mar 09 '22 at 19:16
  • @tester but what operating system is your gitlab job running on? – M.P. Korstanje Mar 09 '22 at 19:42

1 Answers1

2

GitLab docker jobs execute in Linux docker containers. Your executable (.exe file) is a win32 binary and cannot be used in jobs running in Linux containers.

Download the linux chromedriver and specify that file instead.

sytech
  • 29,298
  • 3
  • 45
  • 86
  • I have replaced chromedriver.exe with linux chromedriver , but error is still present java.lang.IllegalStateException: The driver is not executable: /builds//cucumber-testing/./src/drivers/chromedriver – tester Mar 09 '22 at 20:09
  • @tester you must also set the executable bit on the file. You can either [do this with git](https://stackoverflow.com/questions/21691202/how-to-create-file-execute-mode-permissions-in-git-on-windows) or you can run `chmod +x ./src/drivers/chromedriver` as part of your GitLab job – sytech Mar 09 '22 at 20:20
  • if I understood correctly I have added "chmod +x ./src/drivers/chromedriver" to gitlab-ci.yml https://share.getcloudapp.com/L1uRxQL4 – tester Mar 09 '22 at 20:45
  • after pipeline running next error is shown https://share.getcloudapp.com/JruOzqNE – tester Mar 09 '22 at 20:53
  • @tester this sounds like a second question and probably should be asked separately. – sytech Mar 09 '22 at 20:57