Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Selenium Tests Passing in Docker Locally But Failing in Bitbucket Pipeline

I have a Django project that we are running Selenium UI tests for. I have the tests running locally in Docker, but the same tests are failing when run through BitBucket Pipelines. 

The relevant portion of the Pipeline config looks like this:

image: python:2
- step:
- pip
script: # Modify the commands below to build your repository.
- echo "Simple changes kick off pipelines!"
- step:
- pip

- apt-get update
- apt-get install -y libxss1 libappindicator1 libindicator7 libxi6 libgconf-2-4
- wget
- dpkg -i google-chrome*.deb || true
- apt-get install -f -y
- apt-get install -y xvfb unzip
- wget -N
- unzip && chmod +x chromedriver
- mv -f chromedriver /usr/local/share/chromedriver
- ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
- ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
- pip install pyvirtualdisplay selenium
- cd tsmartweb && pip install -r requirements.txt && pip install -r requirements-dev.txt
- pytest

And the corresponding Dockerfile looks like this:

FROM python:2

RUN apt-get update
RUN apt-get install -y libxss1 libappindicator1 libindicator7 libxi6 libgconf-2-4 xvfb unzip
RUN wget

RUN dpkg -i google-chrome*.deb || true
RUN apt-get install -f -y

RUN wget -N
RUN unzip
RUN chmod +x chromedriver

RUN mv -f chromedriver /usr/local/share/chromedriver
RUN ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
RUN ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
RUN pip install pyvirtualdisplay selenium

RUN mkdir -p /usr/local/src/
ADD . /usr/local/src/
RUN cd /usr/local/src/projectName/ && pip install -r requirements.txt
RUN cd /usr/local/src/projectName/ && pip install -r requirements-dev.txt

CMD ["pytest"]

To test I've been building the image, and running it with this command:

docker run -t -i --volume=/Users/username/.aws:/root/.aws --memory=4g --memory-swap=4g --memory-swappiness=0 --workdir="/usr/local/src/projectName" 4aec08b23718 pytest

Most of my tests pass locally, but none pass in Bitbucket. I'm getting this error in the console:

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f595777c410>response = {'sessionId': 'd30ab389776d7ad689bbaa055f460cbf', 'status': 7, 'value': {'message': 'no such element: Unable to locate...9.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.19.23-coreos-r1 x86_64)'}}


> raise exception_class(message, screen, stacktrace)E NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"navbar-username"}E (Session info: headless chrome=74.0.3729.131)E (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.19.23-coreos-r1 x86_64)

Why would tests pass in my local Docker environment, but not in Pipelines?


- macOS version 10.14.4 (18E226)

Docker version 18.09.2, build 6247962


2 answers

Of course, as soon as I post this the answer comes becomes apparent. IAM permission differences between my keys I'm using to test locally and the keys used in Bitbucket environmental variables. 

If anyone else runs into this issue, I was able to diagnose the problem by downloading the screenshots that Selenium takes on failure as artifacts, as defined in the Pipelines config. 

Many thanks! Your YAML is something that helped me a lot to start using pipelines and selenium tests on top of it!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

327 views 2 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you