LeanFT for Selenium

LeanFT for Selenium is a solution that extends the Selenium API, increasing productivity and enabling you to create more robust and more maintainable Selenium tests.

Introduction

LeanFT for Selenium includes the following capabilities:

  • .NET, Java, and JavaScript SDKs that extend the WebDriver API with additional locators and utilities. By using these SDKs you can create more robust or generic identifications for your objects, and use built-in utilities rather than writing them yourself from scratch.

  • An IDE plugin (for Visual Studio, Eclipse, Spring Tool Suite, and IntelliJ IDEA) that provides you with:

    • IDE project templates for Selenium projects (Java and C#). By using these templates you can create projects that are ready for Selenium automation.

    • Easy access to a dedicated Selenium Object Identification Center (OIC). The OIC is a spying tool that enables you to efficiently build WebDriver-based object identifications, validate them, and generate the identification code easily, significantly improving test creation time. For more information, see Object Identification Center for Selenium.

Note:  

  • LeanFT for Selenium is supported on Windows, Linux, and Mac environments.
  • LeanFT for Selenium supports running your tests with Selenium Grid.

The LeanFT for Selenium SDKs are available as open source projects in GitHub:

Back to top

Before you start

Install and configure browsers and relevant Selenium WebDriver drivers

  1. Log into the LeanFT machine as administrator.

  2. Install the browsers that you will be working with in their default installation locations. For supported browsers for Selenium, see the Product Availability Matrix.

  3. Download and extract the Selenium WebDriver drivers relevant for your browsers. See the Selenium website.

    Note:  

  4. Add the location of the WebDriver drivers to the system environment Path variable.

    For example, if your browser driver is located in C:\WebDrivers, add C:\WebDrivers to the Path variable.

Non-Maven Java projects

If you are developing your Selenium tests in Java, download the Selenium JAR files to the LeanFT machine. For details, see Selenium's documentation.

Tip: This can be the Selenium standalone JAR, or the collection of the Selenium Java binding JAR files.

Back to top

Set up a JavaScript LeanFT for Selenium package

  1. Create a folder (in any location) for the tests that you will create.
  2. Deploy the SDK to the test folder.

    In the test folder, run the following command:

    npm install leanft-selenium-js-sdk --save

    Note: You must run this command for each test folder that you create.

    For more information, refer to https://www.npmjs.com/package/leanft-selenium-js-sdk.

  3. Install the selenium node module. From the test folder, run the following command:

    npm install selenium-webdriver

Back to top

Create a Java LeanFT for Selenium project

Do one of the following:

  • Create a project using the LeanFT for Selenium templates:

    In your IDE, create a new Selenium project using the New Project wizard. For details, see Create a LeanFT testing project or module.

    1. Select Selenium.
    2. For non-Maven-based projects, provide the path to the Selenium JAR files.

    The project is created with all the required LeanFT and Selenium libraries.

  • Add the LeanFT for Selenium Java SDK to an existing Java Maven project:

    Add the following dependencies to your pom.xml file: 

    <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>         <version>2.53.1</version> </dependency> <dependency> <groupId>com.microfocus.adm.leanft</groupId> <artifactId>leanft-selenium-java-sdk</artifactId> <version>1.0</version> </dependency>

Back to top

Create a .NET LeanFT for Selenium project

Do one of the following:

  • Create a project using the LeanFT for Selenium templates:

    1. In Visual Studio, create a LeanFT for Selenium project using the New Project wizard.

      The project is created with all the required LeanFT libraries.

    2. Install the Selenium.WebDriver and Selenium.Support packages using one of the Visual Studio options: Manage NuGet Packages or the Package Manager Console.

  • Add the LeanFT for Selenium .NET package to an existing .NET project:

    In an existing project, install the LeanFT.Selenium package using one of the Visual Studio options: Manage NuGet Packages or the Package Manager Console.

    This also installs the Selenium.WebDriver and Selenium.Support packages.

Back to top

Implement your Selenium test

After setting up your LeanFT for Selenium package or project, implement your test as you would any other Selenium test:

Use the Selenium SDK and the relevant LeanFT for Selenium SDKs.

The SDKs include an extended set of locators that can:

  • Identify elements by their visible text
  • Identify input elements by their type
  • Identify elements by attributes and styles
  • Provide a regular expression as a locator's value
  • Identify elements by a combination of locators

Use the Object Identification Center for Selenium

To identify (spy) objects in your application and easily generate a description code for this element to be used in your test.

Back to top