- Pin a browser to a specific version
- Same testing on all operating systems
- No more holding upgrade for your browser
- Easy scaling
- Adds another stack of your learning (which can be a good thing depending on the person)
There are also other paid solutions which are easier to use but come with a price. If you’re okay with that, then I highly recommend them as they don’t need a lot of setup to do and they easily scale with your stack.
To use the image, we’ll need to pull the image, run it, and then point our tests to the browser running in the container
Let’s do the first step in pulling our images that we need to run.
docker pull selenium-hub
docker pull selenium/node-firefox
Now lets run our images.
docker run -d -p 4444:4444 --name selenium-hub selenium/hub
This will run the image in the background and on port 444 with a name of selenium-hub.
The selenium-hub doesn’t have a browser yet; hence, we need to connect a browser to it. Here is how you can do this.
docker run -d -p -p 5900:5900--link selenium-hub:hub selenium/node-firefox-debug
--link selenium-hub:hub is very important to connect our Firefox node to the main selenium hub.
Now we can test it out.
Here is a quick snippet to test if our setup is running:
If there’s no output from the terminal, then that means our setup is a success.
VNC: Looking through the eyes
Now depending which OS you are using, you can install most VNC clients to connect to the container.
In my case, I’m using a cross platform client called TigerVNC
So open the application and connect to this address:
Now run your functional test; you should see something like this:
Here you can create the content that will be used within the module.