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 : Cannot start the driver service on http://localhost:34811/
)
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 :)
#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 Tests
services:
- 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");
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:trx
services:
- 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:latest
ports:
- "4444:4444
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is my latest version of the .yml file. Getting the same error:
image: mcr.microsoft.com/dotnet/sdk:5.0
pipelines:
default:
- step:
services:
- selenium-standalone
script: # 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:latest
port: 4444
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.