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

How to get chromedriver working in pipelines

Doug.Miller February 3, 2020

When running tests in a maven project locally, it works using `mvn test`, but when the repo was committed to bitbucket and and the pipeline launched, it errored with `/root/.m2/repository/webdriver/chromedriver/linux64/79.0.3945.36/chromedriver: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory` .

The bitbucket-pipelines.yml:

  • # This is a sample build configuration for Java (Maven).
    # Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
    # Only use spaces to indent your .yml configuration.
    # -----
    # You can specify a custom docker image from Docker Hub as your build environment.
    image: maven:3.6.3

    pipelines:
    custom:
    pipelinerun:
    - step:
    caches:
    - maven
    script:
    - mvn clean test # -B batch mode makes Maven less verbose

 

Do I need a different docker image? I don't have docker installed locally and don't know much about it to know how to create one with chromedriver, openJdk and maven installed, and I'm not 100% that's the issue either. The dependency section of the maven POM here also if that helps:


  • <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
    </dependency>
    <dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.1.0</version>
    <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>7.3.0</version>
    </dependency>
    </dependencies>

2 answers

1 accepted

0 votes
Answer accepted
Doug.Miller February 4, 2020

In case someone else comes across something like this, my pipeline yaml:

image: maven:3.6.3-jdk-13

pipelines:
custom:
pipelinerun:
- step:
script:
- yum install -y wget
- yum install -y unzip
- sh setenv.sh

And created a bash shell script (the last line able) similar to https://gist.github.com/kaze/eb35d0a815553204cb6d1a9129b20163

What was needed was to install chrome and chromedriver on the docker image, which the chosen image didn't have. Also, I was trying apt-get, but that's not the package manager, yum is.

0 votes
Eve_Rose February 5, 2020

You can add a service for selenium with chrome and chrome driver. There's already an existing docker image for this which you can use. No need to add necessary script for installation.

pipelines:

default:

     - step:

           caches:

               - <whatever cache>

            services:

               - selenium-standalone

             script:

               - <whatever script>

 

definitions:

    services:

      selenium-standalone:

           image: selenium/standalone-chrome:latest

           port: 4444

Doug.Miller April 23, 2020

The problem with this image is it does not have maven installed, and thus cannot start a maven project

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events