Features
< Back to Blog Overview

Building your own Selenium Server

2016-09-21
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

In this article we'll show you how to set up your own Selenium Grid to run tests on various versions of Firefox.


If you are new to setting up your own Selenium Grid, we recommend you first read our other blogpost: Setting up and Maintaining your own Selenium Grid.


1. Download the Firefox versions you want to run tests on

The first step is to download the different versions of Firefox you want to run WebDriver tests on. Mozilla makes this very easy: you can use their FTP website to download the versions you want: https://ftp.mozilla.org/pub/firefox/releases/.


Once downloaded, extract and install these versions on the machine that will run your Selenium Node. The clean solution is to extract and install these to a separate folder, for example C:\firefox\45 on Windows or /Users/Shared/firefox/45 (where 45 is the version number).

2. Register the different Firefox versions on your Selenium Grid

You need to indicate to your Selenium Hub (which is the server connecting the nodes to a Selenium Grid) which versions of Firefox your node supports.


This way, when you later run a test asking for a specific version of Firefox, the Grid knows what machine in the Grid is provisioned with the version you're requesting.


Simply edit your node.json file (which the Selenium node uses to advertise its available browser combinations via java -jar selenium.jar -role node -hub http://hubHost:4444/grid/register -nodeConfig node.json)


node.json contains:

{
  "capabilities":
  [
    {
      "browserName": "firefox",
      "version": "45",
      "platform": "WINDOWS",
      "maxInstances": 1
    },
    {
      "browserName": "firefox",
      "version": "46",
      "platform": "WINDOWS",
      "maxInstances": 1
    }
  ],
  "configuration":
  {
    "nodeTimeout":120,
    "port":5555,
    "hubPort":4444,
    "hubHost":"localhost",
    "nodePolling":2000,
    "registerCycle":10000,
    "register":true,
    "cleanUpCycle":2000,
    "timeout":30000,
    "maxSession":1,
  }
}

With this example, we'll notify the hub (which is running on hubHost port 4444) that this node has both Firefox 45 and Firefox 46 available for testing.

3. Running a test on a specific Firefox version

Once you registered a node to the Selenium hub (grid) with different Firefox versions, you can create tests that target different Firefox versions:

import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.URL;

public class JavaSample {

  public static final String URL = "http://key:secret@hub.testingbot.com/wd/hub";

  public static void main(String[] args) throws Exception {

    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("browserName", "Firefox");
    caps.setCapability("version", "46");
    caps.setCapability("platform", "WIN10");
    caps.setCapability("name", "My First Test");

    WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
    driver.get("http://www.google.com/ncr");
    WebElement element = driver.findElement(By.name("q"));

    element.sendKeys("TestingBot");
    element.submit();

    System.out.println(driver.getTitle());
    driver.quit();

  }
}

4. Take advantage of TestingBot's large grid

Setting up a grid with all kinds of browsers, browser versions and platform combinations takes up a lot of time! Maintaining the grid: installing updates, fixing issues, debug network problems, speeding up VMs takes even more time...


Take advantage of the TestingBot Selenium Grid which has all browsers and versions installed, on a wide range of platforms. We offer all browser versions, ranging from Firefox 3 to Firefox dev/beta, Chrome, Safari, IE, Edge and many more browser combinations.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

blank

TestingBot provides an option for people who want to run their Selenium tests with the latest Selenium 3 beta versions! Selenium 3 is currently st...

Read more
Opera Automated Selenium Testing and Manual Browser testing

TestingBot now supports the latest Opera versions for both Automated and Manual Browser Testing.

Read more
Android Marshmallow (6.0) Selenium Testing

TestingBot now offers Android Marshmallow Emulators to run Automated Selenium Tests and Manual tests.

Read more
macOS Sierra Automated and Manual testing

This week, Apple introduced the OS that will replace OS X El Capitan, called macOS Sierra.

Read more
blank

With Selenium Webdriver, you can run tests on Firefox, Chrome and Safari, all of them equipped with your browser extension. At TestingBot, we've...

Read more
Safari Technology Preview: Automated Testing with WebDriver

Safari Technology Preview provides a way to have an early look at the upcoming web technologies in OS X and iOS.

Read more