Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JulienBreton/selenium-3-setup
A sample to start tests with Selenium 3 in Docker containers
https://github.com/JulienBreton/selenium-3-setup
docker-selenium selenium-grid selenium-webdriver test-automation
Last synced: 3 months ago
JSON representation
A sample to start tests with Selenium 3 in Docker containers
- Host: GitHub
- URL: https://github.com/JulienBreton/selenium-3-setup
- Owner: JulienBreton
- Created: 2019-01-12T20:17:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-15T06:52:01.000Z (over 3 years ago)
- Last Synced: 2024-07-30T20:52:29.398Z (6 months ago)
- Topics: docker-selenium, selenium-grid, selenium-webdriver, test-automation
- Language: Java
- Homepage:
- Size: 168 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# selenium-3-setup
Maven project to start tests with Selenium Grid.
### Set up the testing environment on Ubuntu
#### Option 1 : Use docker-selenium to set up the testing environment
[docker-selenium project on github](https://github.com/SeleniumHQ/docker-selenium/tree/selenium-3)
* [Get Docker CE for Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
* To run docker as a normal user, run this command : `sudo usermod -a -G docker $USER` and reboot your computer.
* [Install Docker Compose](https://docs.docker.com/compose/install/)
* To execute the docker-compose yml file use `docker-compose -f composer/docker-compose.yaml up`.
* Add the `-d` flag at the end for detached execution.
* To stop the grid and cleanup the created containers, run `docker-compose -f composer/docker-compose.yaml down`.
* 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.](https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-timeouts-version-221-required)
```
hub:
image: selenium/hub:3.141.59
restart: on-failure
ports:
- "4444:4444"
environment:
- GRID_TIMEOUT=300
- GRID_BROWSER_TIMEOUT=300
```#### Option 2 : Download and start the selenium-server-standalone.
If you can't use docker, you can use this solution.
##### Downloads
* [Download selenium-server-standalone](https://www.seleniumhq.org/download/)
* [Download geckodriver](https://github.com/mozilla/geckodriver/releases)
* [Download chromedriver](http://chromedriver.chromium.org/downloads)##### Start Selenium Grid
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
```### Launch the tests
`mvn test`