python-chromedriver
Python with Chromedriver, for running automated tests
5M+
Python with Chromedriver, for running automated tests
$ git clone https://github.com/joyzoursky/docker-python-chromedriver.git
$ cd docker-python-chromedriver
$ docker run -it -w /usr/workspace -v $(pwd):/usr/workspace joyzoursky/python-chromedriver:latest bash
/usr/wrokspace# pip install selenium
/usr/wrokspace# python test_script.py
3.9, latest (based on python:3.9, Dockerfile)3.9-selenium (based on python:3.9 with selenium installed, Dockerfile)3.8 (based on python:3.8, Dockerfile)3.8-selenium (based on python:3.8 with selenium installed, Dockerfile)3.7 (based on python:3.7, Dockerfile)3.7-selenium (based on python:3.7 with selenium installed, Dockerfile)3.6 (based on python:3.6, Dockerfile)3.6-selenium (based on python:3.6 with selenium installed, Dockerfile)3.9-alpine (based on python:3.9-alpine, Dockerfile)3.9-alpine-selenium (based on python:3.9-alpine with selenium installed, Dockerfile)3.8-alpine (based on python:3.8-alpine, Dockerfile)3.8-alpine-selenium (based on python:3.8-alpine with selenium installed, Dockerfile)3.7-alpine (based on python:3.7-alpine, Dockerfile)3.7-alpine-selenium (based on python:3.7-alpine3.8 with selenium installed, Dockerfile)3.6-alpine (based on python:3.6-alpine, Dockerfile)3.6-alpine-selenium (based on python:3.6-alpine with selenium installed, Dockerfile)2.7 (based on python:2.7, Dockerfile)2.7-selenium (based on python:2.7 with selenium installed, Dockerfile)2.7-alpine3.7 (based on python:2.7-alpine3.7, Dockerfile)2.7-alpine3.7-selenium (based on python:2.7-alpine3.7 with selenium installed, Dockerfile)3.6-xvfb (based on python:3.6 with xvfb installed, Dockerfile)3.6-xvfb-selenium (based on python:3.6 with xvfb and selenium installed, Dockerfile)2.7-xvfb (based on python:2.7 with xvfb installed, Dockerfile)2.7-xvfb-selenium (based on python:2.7 with xvfb and selenium installed, Dockerfile)For the following Debian-based images:
latest3.93.9-selenium3.83.8-selenium3.73.7-selenium3.63.6-selenium3.6-xvfb3.6-xvfb-selenium2.72.7-selenium2.7-xvfb2.7-xvfb-seleniumRun the followings in your terminal:
$ cd [your working directory]
$ docker run -it -w /usr/workspace -v $(pwd):/usr/workspace joyzoursky/python-chromedriver:[version] bash
For the following Alpine-based images:
3.9-alpine3.9-alpine-selenium3.8-alpine3.8-alpine-selenium3.7-alpine3.7-alpine-selenium3.6-alpine3.6-alpine-selenium2.7-alpine2.7-alpine-seleniumRun the followings in your terminal:
$ cd [your working directory]
$ docker run -it -w /usr/workspace -v $(pwd):/usr/workspace joyzoursky/python-chromedriver:[version] sh
This will create a container from the image. Then you could starting running the commands in the container as in your working directory. The followings are some examples to run a selenium test.
You can download a selenium test example from here to quick start.
For the following images with selenium pre-installed:
3.9-alpine-selenium3.9-selenium3.8-alpine-selenium3.8-selenium3.7-alpine-selenium3.7-selenium3.6-alpine-selenium3.6-selenium2.7-alpine-selenium2.7-seleniumYou may run:
# python test_script.py
For the following images that do not have selenium pre-installed:
latest3.9-alpine3.93.8-alpine3.83.7-alpine3.73.6-alpine3.62.7-alpine2.7You may run:
# pip install selenium
# python test_script.py
For 3.6-xvfb or 2.7-xvfb, you may run:
# pip install selenium
# xvfb-run --server-args="-screen 0 1024x768x24" python test_script.py
For 3.6-xvfb-selenium or 2.7-xvfb-selenium, you may run:
# xvfb-run --server-args="-screen 0 1024x768x24" python test_script.py
Then you should see the test result like this:
test_case_1 (__main__.TestTemplate)
Find and click top-left logo button ... ok
test_case_2 (__main__.TestTemplate)
Find and click top-right Start your project button ... ok
----------------------------------------------------------------------
Ran 2 tests in 11.852s
OK
To make changes upon the existing Dockerfiles, you are suggested to edit upon the Dockerfile.template files, and generate the new Dockerfiles for different versions by running render.sh.
cd to the folder that you want to edit, e.g. py-debianDockerfile.template or Dockerfile-selenium.templatebash render.sh from command-lineNote: The render.sh is written for Mac OS; If you are using Windows or other OS, some commands may need to be optimised before running.
Thanks a lot for helping on improving this project!
Content type
Image
Digest
Size
541.6 MB
Last updated
almost 5 years ago
docker pull joyzoursky/python-chromedriver:3.8-selenium