How to run Selenium side runner in bitbucket pipeline?
Asked by Divyanka:

I have tried running selenium side runner via Jenkins using below command:

selenium-side-runner -c "browserName=chrome goog:chromeOptions.args=\[disable-infobars,headless\]" myfile.side

Not sure how to run my tests in the pipeline, however, I tried below approach, but pipeline is failing:  
image: atlassian/default-image:3

pipelines:  
default:  
- parallel:  
- step:  
name: 'Build and Test'  
script:  
- echo "Your build and test goes here..."  
- step:  
name: 'Lint'  
script:  
- echo "Your linting goes here..."  
- step:  
name: 'Security scan'  
script:  
- selenium-side-runner -c "browserName=chrome goog:chromeOptions.args=\[disable-infobars,headless\]" ./myfile.side  
Error: ![Untitled.png](https://community.atlassian.com/t5/image/serverpage/image-id/173256iE621EE9E366D55FB/image-size/large?v=v2&px=999 "Untitled.png")


Answers:
author: Mahmoud Sameer
body: Hi   
did u find the solution?


author: Igor Stoyanov
body: [@Divyanka](/t5/user/viewprofilepage/user-id/4372857) hi. Thanks for your question.

Try to use docker image with selenium-side-runner. As an example [this image](https://hub.docker.com/r/nixel2007/docker-selenium-side-runner/).

```
- step:
  name: 'Security scan'
  image: nixel2007/docker-selenium-side-runner:latest
  script:
    - selenium-side-runner -c "browserName=chrome goog:chromeOptions.args=[disable-infobars,headless]" ./myfile.side
```

Regards, Igor

comments: author: Divyanka
body: Hi, [@Igor Stoyanov](/t5/user/viewprofilepage/user-id/4550492) can you please share your pipeline yml file for the reference


author: Igor Stoyanov
body: [@Divyanka](/t5/user/viewprofilepage/user-id/4372857) hi. Try this one:

```
image:
  name: atlassian/default-image:3

test: &test
  parallel:
    - step:
        name: 'Build and Test'
        script:
          - echo "Your build and test goes here..."
    - step:
        name: 'Lint'
        script:
          - echo "Your linting goes here..."
    - step:
        name: 'Security scan'
        image: nixel2007/docker-selenium-side-runner:latest
        script:
          - selenium-side-runner -c "browserName=chrome goog:chromeOptions.args=[disable-infobars,headless]" ./myfile.side


pipelines:
  default:
  - <<: *test
  branches:
    master:
    - <<: *test
```

Also additionally you can try [this guide](https://medium.com/@yiquanzhou/run-selenium-ui-tests-in-docker-container-78be98e1b52d) or [this guide](https://medium.com/nonstopio/run-selenium-tests-in-bitbucket-pipeline-64e0dcdd1a1f).

Regards, Igor.


author: Divyanka
body: Thanks I tried, I was getting error: ChromeDriver not found, then I tried pulling headless chrome, still getting this error:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/173609iB405C6A958F85A1D/image-size/large?v=v2&px=999 "image.png")

YML file:

```
image: atlassian/default-image:3

?

pipelines:

? default:

?????? - step:

????????? name: Build and test

????????? image: zenika/alpine-chrome

????????? caches:

????????? - node

????????? script:

??????????? - docker version

??????????? - docker pull browserless/chrome:latest

????????? services:

??????????? - docker

?????????

?????? - step:

????????? name: 'Test'

????????? image: nixel2007/docker-selenium-side-runner:latest

????????? script:

??????????? - selenium-side-runner -c "browserName=chrome goog:chromeOptions.args=[disable-infobars,headless]" ./ConsoleTesting.side

?
```


Tags: bitbucket-pipelines

cloud

selenium