Skip to content

Docker Selenium Grid - Build and Manage a Selenium Grid using Docker

License

Notifications You must be signed in to change notification settings

jlmorton/dsgrid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Selenium Grid

CLI program for building and managing a Selenium Grid with Docker containers. Each browser node runs a single instance of the browser. I find this helpful when running Selenium tests in parallel.

View the Demo Installation and Usage on Ubuntu Raring with Vagrant

Requirements

  • Docker
  • Python
  • pip

Installation

This installation will build the following Docker containers: Selenium Hub, PhantomJS, Chrome, and Firefox. Note: If you want to customize the Dockerfiles, do so in /usr/local/dsgrid/files before running the install.

# Note: you may have to use "sudo" if your linux user does not have proper permissions
pip install dsgrid
dsgrid install

Usage

Once installed you can start and manage a Selenium Grid. Example:

# Note: you may have to use "sudo" if your linux user does not have proper permissions
# Start the Hub
dsgrid start
# Add Nodes 
dsgrid nodes add firefox
dsgrid nodes add phantomjs
# Restart Nodes by Browser
dsgrid nodes restart firefox
# Restart All Nodes
dsgrid nodes restart
# Check Status
dsgrid status
# Shutdown
dsgrid shutdown

View the Grid console on: http://localhost:49044/grid/console

Installing and Using within Docker

You don't even need to use pip. The grid manager can be run from inside docker on minimal systems.

docker run -v /var/run/docker.sock:/var/run/docker.sock calebtomlinson/dsgrid dsgrid install

Use any of dsgrid commands from inside the container.

docker run -v /var/run/docker.sock:/var/run/docker.sock calebtomlinson/dsgrid dsgrid start
docker run -v /var/run/docker.sock:/var/run/docker.sock calebtomlinson/dsgrid dsgrid nodes add firefox
docker run -v /var/run/docker.sock:/var/run/docker.sock calebtomlinson/dsgrid dsgrid shutdown

Hacking

Feel free to hack the Dockerfiles and scripts under files/. Pull requests are welcomed.

Author Note

I put this together over a weekend. I am not very strong in Python but wanted to build a CLI app which can be easily installed on Docker hosts.

The tests are incomplete. What you see are my TDD leftovers.

Special Thanks

  • Yassine Jaffoo (Yas)

Having Problems? Need Help?

Author Email: brady[at]vitrano.me or get my Gmail from the setup.py

About

Docker Selenium Grid - Build and Manage a Selenium Grid using Docker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 76.0%
  • Shell 24.0%