Book Image

Selenium Essentials

By : Prashanth Sams
Book Image

Selenium Essentials

By: Prashanth Sams

Overview of this book

Table of Contents (12 chapters)

Tests on specific Firefox versions

The Firefox binary lets you run tests on your favorite Firefox versions. In order to do that, perform the following steps:

  1. Install multiple versions of Firefox on your PC (say, FF 26 and FF 28). Make sure that the Mozilla Firefox versions are installed at different path locations using custom installation.

  2. Add the following imports in your test code:

    import org.openqa.selenium.firefox.FirefoxBinary;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxProfile;
  3. Locate the secondary Firefox executable path in the Firefox binary.

  4. Create a Firefox profile and initialize WebDriver as shown in the following code snippet:

    FirefoxBinary binary = new FirefoxBinary(new File("C://Program Files//Mozilla Firefox26//firefox.exe"));
    FirefoxProfile profile = new FirefoxProfile();
    WebDriver driver = new FirefoxDriver(binary, profile);
  5. For Python bindings, use a similar scenario and add the following code snippet: