Selenium: easy as a pie

As you probably know we in Aerokube team continue simplifying things in software testing infrastructure. Currently we are working hard on delivering efficient tools for Selenium-compatible browser automation. One of our tools I have already talked about is called Selenoid. This is a lightweight server launching isolated browsers in Docker containers. In my previous articles (one, two) I described two main cases of using Selenoid — using Docker and using standalone webdriver binaries on platforms with no Docker support. Today I’m going to talk about new awesome Selenoid features that can help you a lot when launching tests in browsers.

Live Browser Screen

One of the cool features delivered by online Selenium services is an ability to see browser screen during test execution. This helps a lot when debugging tests and everybody (including your boss or team manager) likes browser cartoons. The good news — we recently added live browser screen support to Selenoid.

To use this feature:

  • Pass one additional capability in your tests:
enableVNC = true
  • Start Selenoid UI and go to VNC tab.
  • Start your tests — you will see the session appearing as a rectangle with browser name and screen resolution. (… image with rectangle)
  • Just click on this rectangle and you will see live browser screen.

This works by starting VNC server inside container and connecting to it from browser. This is why you have to use container images with VNC server inside. Our default images (e.g. selenoid/firefox:53.0) do not contain VNC because they were created to be used in big cluster where VNC is rarely needed. Please use reference tables in Selenoid documentation to find ready to use VNC images for most popular browser versions.

Live session logs

Being experienced Selenium user sometimes you may want to look at live sessions logs. Good news — this is already supported in Selenoid. Using this feature is even easier — just start Selenoid UI and go to Logs tab. You will be then able to see session logs while browser is running. If you wish to save container logs when session has finished — take a look at documentation section about configuring logging properties for Selenoid.

Automated Installer

Although Selenium is relatively simple tool its initial configuration can be tricky. Some libraries like Angular webdriver-manager already automate most of the work but they require e.g. Node.js and Java to be installed manually. What if you could get ready to use browsers by typing just one command? We did an effort and implemented a small configuration tool that does all the work for you and has no external dependencies. It is called just cm which stands for configuration manager. So to become happy:

On Mac:

$ curl -Lo cm https://github.com/aerokube/cm/releases/download/1.2.0/cm_darwin_amd64
$ chmod +x ./cm

On Linux:

$ curl -Lo cm https://github.com/aerokube/cm/releases/download/1.2.0/cm_linux_amd64
$ chmod +x ./cm

On Windows — there is no universal command, just click on of the links depending on your Windows version: 32 bit or 64 bit and save the file as cm. However if you have Powershell installed type almost the same command:

> curl -Lo cm.exe https://github.com/aerokube/cm/releases/download/1.2.0/cm_windows_amd64 
  • Run one command:
$ ./cm selenoid start --vnc

On Windows it is:

> .\cm.exe selenoid start

This will download latest Selenoid, browser container images, webdriver binaries, generate configuration files and finally start Selenoid. When finished — just run your tests against usual URL:

http://localhost:4444/wd/hub

Similarly to automatically start Selenoid UI with zero effort type:

# ./cm selenoid-ui start