#!/bin/bash -eo pipefail
chromedriver --url-base=/wd/hub
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 9515
Only local connections are allowed.
[1623037436.616][SEVERE]: bind() returned an error, errno=99: Cannot assign requested address (99)
I am new to Circle CI, CI/CD in general, so I tried to install everything into the container following these instructions: How to Setup Selenium with ChromeDriver on Ubuntu 18.04 & 16.04 – TecAdmin
I can run the tests locally but get that error on Circle CI with my config.yml below:
version: 2.1
orbs:
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files
# Orb commands and jobs help you with common scripting around a language/tool
# so you dont have to copy and paste it everywhere.
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
python: circleci/python@1.2
workflows:
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
jobs:
- build-and-test
jobs:
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
# These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
# Change the version below to your required version of python
docker:
- image: cimg/python:3.8
# Checkout the code as the first step. This is a dedicated CircleCI step.
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
# Then run your tests!
# CircleCI will report the results back to your VCS provider.
steps:
- checkout
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
# install java, chrome, chrome driver
# https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/
- run: sudo apt-get update
- run: sudo apt-get install -y unzip xvfb libxi6 libgconf-2-4
- run: sudo apt-get install default-jdk
# Google Chrome
- run: sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
#- run: echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> sudo tee /etc/apt/sources.list.d/google-chrome.list
- run: sudo sh -c "echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list"
- run: sudo apt-get -y update
- run: sudo apt-get -y install google-chrome-stable
# install Chrome Driver
- run: wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
- run: unzip chromedriver_linux64.zip
- run: sudo mv chromedriver /usr/bin/chromedriver
- run: sudo chown root:root /usr/bin/chromedriver
- run: sudo chmod +x /usr/bin/chromedriver
# download required Jar Files
# https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/
- run:
name: Download Selenium
command: wget https://selenium-release.storage.googleapis.com/3.13/selenium-server-standalone-3.13.0.jar
- run: wget http://www.java2s.com/Code/JarDownload/testng/testng-6.8.7.jar.zip
- run: unzip testng-6.8.7.jar.zip
- run:
name: Run Chrome via Selenium Server
command: xvfb-run java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.13.0.jar
background: true
- run:
name: Start Headless ChromeDriver
command: chromedriver --url-base=/wd/hub
- run:
name: Run Dash tests
# This assumes pytest is installed via the install-package step above
command: pytest
I am going to try using the circleci/python:3.6.2-stretch-browsers
as shown here: 2.0 Project Tutorial - CircleCI but last time it said /bin/bash no command java
so I will install java this time but that seemed strange for it not to have Java.
How can I get the above version to work?