Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,264
Community Members
 
Community Events
184
Community Groups

How to configure the bitbucket pipeline YAML file to add the selenium chrome image (standalone-chrom

Edited
Dheeraj Singla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 23, 2023
I want to run selenium script (Java, Maven & Selenium) in bitbucket pipeline. For this I want to use a image selenium/standalone-chrome from docker hub. But I don't know how to configure my bitbucket-pipelines.yml for this. Currently I am using below yaml file in my project and I am getting below error on bitbucket pipeline -
Error

Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'

System info: host: '2469e757-cd7e-46a6-815f-e4e651a95a17-5cdxg', ip: '10.36.149.209', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1035-aws', java.version: '11.0.3'


 

Note

I am using selenium hub server(http://localhost:4444/wd/hub) to host the selenium/standalone-chrome container and its working fine when I am launching from my local. But giving above error when pipeline is running on bitbucket.

 


Bitbucket YAML file

image: maven:3.6.0

pipelines:
  default:
    - parallel:
        - step:
            name: Build and Test
            caches:
              - maven
            script:
            #  - mvn -B verify
              - ls -l /opt/atlassian/pipelines/agent/build/chromedriver_win32/
              - mvn test
            after-script:
              # Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
              - pipe: atlassian/checkstyle-report:0.3.0
        - step:
            name: Security Scan
            script:
              # Run a security scan for sensitive data.
              # See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
              - pipe: atlassian/git-secrets-scan:0.5.1
                definitions:
                  services:
                    chrome:
                      image: selenium/standalone-chrome

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 26, 2023

Hi @Dheeraj Singla,

I'm not familiar with Selenium, but I see that you are not actually using the service you have defined in any step. Additionally, the definitions: keyword should be at the same level as pipelines: (I am not sure if the indentation looks the same in your yml file, or if it got messed up here during copy-paste).

If selenium is used in the first step, you could try a yml as follows:

image: maven:3.6.0

pipelines:
default:
- parallel:
- step:
name: Build and Test
services:
- chrome
caches:
- maven
script:
# - mvn -B verify
- ls -l /opt/atlassian/pipelines/agent/build/chromedriver_win32/
- mvn test
after-script:
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
- pipe: atlassian/checkstyle-report:0.3.0
- step:
name: Security Scan
script:
# Run a security scan for sensitive data.
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
- pipe: atlassian/git-secrets-scan:0.5.1

definitions:
services:
chrome:
image: selenium/standalone-chrome

Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file (in your case maven:3.6.0). If you use a service for a step, then a second Docker container will start for the service (using the image you have specified for the service) which will share a network adapter with your build container and open its ports on localhost.

You can have a look at the following guide if you would like to debug this locally with Docker (For step 3, make sure to check Testing with build services before starting the build container locally):

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events