0

We're working on a small docker image container for windows to run a specflow test in a dotnet core projecct. The problem we have is that we can't get chromedriver to work as well as running the dotnet test command.

The specflow project we're running just contains one hello world testcase which we can run without chromedriver, but then we get the error message "OpenQA.Selenium.DriverServiceNotFoundException : The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable." We're providing an instance of chromedriver in the project so we don't have to download it.

The dockerfile we're running:

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY . .
ENV PATH="/src/chromedriver:$PATH"
RUN dotnet test

We're using this command to run it: docker build . --build-arg HTTP_PROXY=http://PROXY:8080 --build-arg HTTPS_PROXY=http://PROXY:8080 --rm

We expect the specflow tests to run with chromedriver. When we run the dockerfile we get the error message "'dotnet' is not recognized as an internal or external command, operable program or batch file." It seems that the chromedriver is not added correctly to the PATH variable. We need it there to be able to run the specflow tests.

Does anybody know how to configure the dockerfile to work correctly with chromedriver?

Thanks for your time.

rick lemmen
  • 101
  • 2
  • If you are adding chrome driver as a nuget package, maybe you should be doing a `dotnet restore` first, so the file gets downloaded? – Aman B Sep 18 '19 at 13:30
  • we're directly copying the chromedriver.exe to /src/chromedriver/ so it's no nuget package. Although that might be something for us to look into in the future :) – rick lemmen Sep 18 '19 at 13:33
  • Try `ENV PATH "$PATH:/src/chromedriver"` – Aman B Sep 18 '19 at 14:42
  • Or look at this to print out values of your environment variables https://stackoverflow.com/questions/34051747/get-environment-variable-from-docker-container/34052766 – Aman B Sep 18 '19 at 14:54

0 Answers0