{"id":22735488,"url":"https://github.com/francomelandri/selenium-grid-tests","last_synced_at":"2026-05-08T04:40:33.769Z","repository":{"id":87974810,"uuid":"173284648","full_name":"FrancoMelandri/selenium-grid-tests","owner":"FrancoMelandri","description":"How to setup Jenkins to run selenium tests in grid mode","archived":false,"fork":false,"pushed_at":"2019-03-08T07:48:28.000Z","size":671,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T02:29:41.788Z","etag":null,"topics":["javascript","jenkins","selenium"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FrancoMelandri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-01T10:40:44.000Z","updated_at":"2019-03-08T11:36:04.000Z","dependencies_parsed_at":"2023-05-22T04:30:17.247Z","dependency_job_id":null,"html_url":"https://github.com/FrancoMelandri/selenium-grid-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancoMelandri%2Fselenium-grid-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancoMelandri%2Fselenium-grid-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancoMelandri%2Fselenium-grid-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancoMelandri%2Fselenium-grid-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrancoMelandri","download_url":"https://codeload.github.com/FrancoMelandri/selenium-grid-tests/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancoMelandri%2Fselenium-grid-tests/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259080939,"owners_count":22802393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","jenkins","selenium"],"created_at":"2024-12-10T21:10:52.357Z","updated_at":"2026-05-08T04:40:28.718Z","avatar_url":"https://github.com/FrancoMelandri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Selenium Grid\n\n\n\n## Abstract\n\nBased on the selenium standalone server\n\nAllows you to scale by distributing tests on several machines ( parallel execution )\n\n\n\nFirst of all you have to launch the hub using the role hub\n\n```bash\n\u003e docker run -d -p 4444:4444 --name selenium-hub selenium/hub:3.141.59-hafnium\n--\n\u003e java -jar selenium-server-standalone-3.9.jar -role hub\n```\n\n\n\n\n\nAfter that you can launch the nodes that communicate with the hub and perform the requested actions by the hub using the role node\n\n```bash\n\u003e docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-hafnium\n\n\u003e docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox:3.141.59-hafnium\n\n---\n\u003e java -jar selenium-server-standalone-3.9.jar -role node -hub http://localhost:4444/grid/register\n```\n\n\n\n\n\n## Jenkins\n\nJenkins allows you to handle Selenium Grid in the right way using the **Selenium Plugin**\n\nThis plugin sets up Selenium Grid in the following way\n\n- On master, Selenium Grid Hub is started on port 4444, unless configured otherwise in Jenkins global configurations. This is where all your tests should connect to.\n\n- For each slave, necessary binaries are copied and Selenium RCs are started.\n- RCs and the Selenium Grid Hub are hooked up together automatically.\n\nGrid can also accept additional nodes launched outside Jenkins.\n\n\n\n## Local environment\n\nSetting up a master slave installation in local to test selenium grid.\nAll the installation is based on a list of docker container, one for jenkins and the other for the selenium nodes.\n\nIn order to let all the container talk to each other we have to insert a new entry in the hosts file with the IP address of the docker Jenkins just launched using a name you want\n\n```bash\n172.18.0.2 jenkins\n```\n\n\nCreate a docker network to group all the docker containers\n\n```bash\n\u003e docker network create grid\n```\n\nand then launch a Jenkins server using docker\n\n\n```bash\n\u003e docker run \\\n    -u root \\\n    --rm \\\n    --net grid \\\n    -p 8080:8080 \\\n    -p 50000:50000 \\\n    -p 4444:4444 \\\n    -v jenkins-data:/var/jenkins_home \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    --name jenkins \\\n    jenkinsci/blueocean\n```\n\nOnce the Jenkins master is uop and running we have to in install the Selenium plugin for Jenkins.\nIn this way we are exposing the jenkins server, the agents and the Selenium grid.\n\nYou have to change the URL of the jenkins server from http://localhost:8080 to http://jenkins:8080\n\n\nAfer the start-uo of Jenkins master we can start the docker image of a slave node in this way (for chrome)\n\n```bash\n\u003e docker run \\\n  --net grid \\\n  -e HUB_HOST=jenkins \\\n  -v /dev/shm:/dev/shm selenium/node-chrome:3.141.59-iron\n```\n\nand for firefox\n\n```bash\n\u003e docker run \\\n  --net grid \\\n  -e HUB_HOST=jenkins \\\n  -v /dev/shm:/dev/shm selenium/node-firefox:3.141.59-iron\n```\n\nSo now we ca start some selenium slave in order to attach to the hub and the hub is inside Jenkins because we have installed the selenium plugin\n\n\n\n## Example\n\nCreated a little example test based on nightwatch and nightwatch cucumber (http://nightwatchjs.org/)\n\nThe most important thing is to configure in the right way nightwatch in order to let the test run in the node test of the grid. So take a look to the file *nightwatch.conf.js*\n\n```\n    selenium: {\n        start_process: false,\n        server_path: seleniumServer.path,\n        host: 'jenkins',\n        port: 4444\n    },\n```\n\nSetting the flag start_process as false we are going to indicate the test must use the remote jenkins hub. \n\nYou can also run the project in you dev environment:\n- install all the npm packages using \n```\nnpm install\n```\n\n- run the test using \n```\nnode nightwatch -e chrome\n```\n\n\n## Pipeline\n\nThe pipeline build a docker image containing all the files needed to launch the test, run the container and after taht run the nightwatch test inside the container.\n\nThe container will be run using --network=host in order to let the container able to find the host name of the selenium hub. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancomelandri%2Fselenium-grid-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrancomelandri%2Fselenium-grid-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancomelandri%2Fselenium-grid-tests/lists"}