I tried following the similar questions asked before but no change in the results.
I'm trying to run a VS 2019 .Net 5.0 project in a bitbucket pipeline but I'm getting the following error when I try initialise a new chromeDriver (OpenQA.Selenium.WebDriverException : <strong>Cannot start the driver service on <a href="http://localhost:34811/" rel="noopener nofollow noreferrer" target="_blank">http://localhost:34811/</a></strong>)
OpenQA.Selenium.WebDriverException : <strong>Cannot start the driver service on <a href="http://localhost:34811/" rel="noopener nofollow noreferrer" target="_blank">http://localhost:34811/</a></strong>
Here is the copy of the yml I'm using (I've tried both the commented and uncommented version but both getting the same result)
Further information about this project is, it's a Selenium/Nunit project in c# running Cucumber feature files.
Locally I'm able to run the project in parallel but only getting issues when trying to run in the pipeline.
Any advice would greatly be appreciated
Copy of both versions of yml used:
1)
pipelines:default:- step:script:- docker version- docker run --rm -v $(pwd)/Swoop-Acceptance:/app -w /app mcr.microsoft.com/dotnet/sdk:5.0 dotnet test --logger:trxservices:- docker
2)
pipelines: default: - step: name: Build and Test caches: - dotnetcore services: - chrome script: - REPORTS_PATH=./test-reports/build_${BITBUCKET_BUILD_NUMBER} - dotnet build Swoop-Acceptance --configuration Debug- dotnet test Swoop-Acceptance --configuration Debug
definitions:
services:chrome:image: selenium/standalone-chrome:latestports:- "4444:4444
Here is my latest version of the .yml file. Getting the same error:
image: mcr.microsoft.com/dotnet/sdk:5.0pipelines:default:- step:services:- selenium-standalonescript: # Modify the commands below to build your repository.- export PROJECT_NAME=Swoop-Acceptance- export TEST_NAME=Swoop-Acceptance- dotnet restore- dotnet build $PROJECT_NAME- dotnet test $TEST_NAME
definitions:services:selenium-standalone:image: selenium/standalone-chrome:latestport: 4444
#define Selenium as a service in bitbucketpipeline file:
definitions: selenium-standalone: image: selenium/standalone-chrome:latest port: 4444
#use it in your step
- step:name: Unit Testsservices:- selenium-standalone
#use this variable and augment with port 4444
echo $BITBUCKET_DOCKER_HOST_INTERNAL
curl -I http://$BITBUCKET_DOCKER_HOST_INTERNAL:4444
#pass this variable into the container that needs to talk to the selenium-standalone service
#set an environment variable e.g.: UTESTVAR and then use that in your test environment
#CSHARP
var options = new ChromeOptions();
options.AddArgument("--headless=new");
WebDriver driver = new RemoteWebDriver(new Uri("http://" + Environment.GetEnvironmentVariable("UTESTVAR") + ":4444"), options);
driver.Navigate().GoToUrl("http://www.google.com");
var sShot = driver.GetScreenshot();
sShot.SaveAsFile("the_screen_shot");
It looks like you're new here. Sign in or register to get started.