Selenium Docker Demo using java programming
This repository contains Dockerfiles for running a simple test using Selenium with JUnit, Maven and Selenium Remote Driver.
You should have Docker Toolbox installed, see https://www.docker.com/toolbox
~/docker-selenium-demo $ docker-machine ls
~/docker-selenium-demo $ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
If the docker engine is not running start the engine.
docker-machine start default
To get all docker containers up and running use:
git clone [email protected]:venkywarriors/docker_selenium_demo.git
cd docker-selenium-demo
docker-compose up
Docker containers running maven does not cache files under the .m2/ folder. Thherefore, maven will download everything from the internet by default. This is slightly annoying but we can fix it by sharing a local repository with the docker container that runs maven. There are more than one way of caching the repository but this is one of the simpler methods. Modify the docker-compose.yml file and add a volume that will be mounted on the container. The example below mount the .m2 from users home folder to /root/.2 (default location for the repository in official maven image):
wikipedia-test:
build: ./wikipedia-test
command: "mvn test"
volumes:
- ~/.m2:/root/.m2
links:
- selfirefox:selfirefox