Sign inSign up

qxf2rohand/python3-selenium-chrome-firefox

By qxf2rohand

•Updated over 7 years ago

This is Qxf2's Base Image designed for running any Python3 based Selenium tests.

Image
0

224

qxf2rohand/python3-selenium-chrome-firefox repository overview

This image includes:

  • Ubuntu 16.04,
  • essential basic tools like curl, unzip, wget, Xvfb etc...,
  • Installing latest or older versions of Chrome and Chrome driver based on the ARG variables (Example shown below) from website https://www.slimjet.com/chrome/google-chrome-old-version.php⁠,
  • Installing latest or older versions of Firefox and Geckodriver,
  • Python 3, and Python3 Pip.

You can use this image for running any python based selenium tests. You can use the regular docker run commands to create a container and just need to setup with selenium and other requirements which are needed to run your tests.

Running the image

$ docker run -it python3-selenium-chrome-firefox:python3

Building your own images

  • If you want to build your own images using this Dockerfile for a specific version of chrome you can use below command.

$ docker build -t python3-selenium-chrome-firefox --build-arg CHROME_DRIVER_VERSION=2.28 --build-arg CHROME_VERSION=57.0.2987.133 -f Dockerfile .

  • If you want to build your own images using this Dockerfile for a specific version of Firefox you can use below command.

$ docker build -t python3-selenium-chrome-firefox --build-arg GECKODRIVER_VERSION=0.19.0 --build-arg FIREFOX_VERSION=59.0.2 -f Dockerfile .

Running python based selenium tests

To run the Selenium tests you need to do the following:

  1. Install Selenium
$ pip install Selenium

  1. Export display and enable Xvfb using the following 2 commands
$ export DISPLAY=:20
$ Xvfb :20 -screen 0 1366x768x16 &

  1. You can also use the sample Selenium code (selenium_sample.py) given below. This test visits Qxf2 Services website and prints the title.
# contents of selenium_sample.py
from selenium import webdriver

driver = webdriver.Chrome()
driver.get("http://www.qxf2.com")
print (driver.title)
driver.quit()

  1. Run the test using the following command:
python selenium_sample.py

Refer to our blog for more details - https://qxf2.com/blog/building-your-own-docker-images-for-different-browser-versions/⁠

Tag summary

Content type

Image

Digest

Size

460.2 MB

Last updated

over 7 years ago

docker pull qxf2rohand/python3-selenium-chrome-firefox:python3