Maven project to start tests with Selenium Grid.
docker-selenium project on github
- Get Docker CE for Ubuntu
- To run docker as a normal user, run this command :
sudo usermod -a -G docker $USERand reboot your computer.
- To run docker as a normal user, run this command :
- Install Docker Compose
- To execute the docker-compose yml file use
docker-compose -f composer/docker-compose.yaml up.- Add the
-dflag at the end for detached execution. - To stop the grid and cleanup the created containers, run
docker-compose -f composer/docker-compose.yaml down.
- Add the
- Scaling up the grid on-demand :
docker-compose -f composer/docker-compose.yaml up -d --scale firefox=2 --scale chrome=2. - Remote address for the client : http://ipserver:4444/wd/hub (e.g.: http://localhost:4444/wd/hub)
- http://localhost:4444/grid/console
- Debugging : to debug your tests you have to use node-chrome-debug and node-firefox-debug (see the composer file). Go to http://localhost:4445/ to list the vnc access. The password is "sercret".
- You can share files between the host and the containers. It is usefull to upload files in a Web app. See /home/julien/test:/home/seluser/upload in the composer/docker-composer.yaml and adapt to your case. seluser is the user in the containers.
- You can rename the folder composer in seleniumv3 (for example) if you want to identify easily the containers in the list displayed by http://localhost:4445/
- If you want to set the timeouts, add GRID_TIMEOUT and GRID_BROWSER_TIMEOUT to the hub in the docker-compose.yaml. To learn more about the timeouts, see also the Grid2 wiki.
hub: image: selenium/hub:3.141.59 restart: on-failure ports: - "4444:4444" environment: - GRID_TIMEOUT=300 - GRID_BROWSER_TIMEOUT=300 If you can't use docker, you can use this solution.
hub :
java -jar selenium-server-standalone-3.141.59.jar -role hub node :
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://localhost:4444/grid/register mvn test