Hello!
Recently I’ve been trying to render its deployment with Docker. As I am new to programming apps with C# and working with Docker, I’ve faced a problem with running the Selenium driver on my app.
Deployment went smoothly, but right away when my driver is about to start, I’ve got an exception like:
OpenQA.Selenium.WebDriverException: Error starting process: /app/selenium-manager/linux/selenium-manager --browser "chrome" --language-binding csharp --output json
System.ComponentModel.Win32Exception (13): An error occurred trying to start process '/app/selenium-manager/linux/selenium-manager' with working directory '/app'. Permission denied
My code, which is running Selenium, looks like this:
var service = ChromeDriverService.CreateDefaultService();
service.SuppressInitialDiagnosticInformation = true;
service.HideCommandPromptWindow = true;
var options = new ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--silent");
options.AddArgument("--window-size=1920,1080");
_mainDriver = new ChromeDriver(service, options);
Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c release -o /app --self-contained -r linux-x64
FROM selenium/standalone-chrome
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["./AppName"]
Any idea what is wrong with my code here?