LeanFT for Selenium

Introduction

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.

LeanFT for Selenium includes the following:

  • 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 Eclipse and IntelliJ IDEA) that provides you with:

    • IDE project templates for Selenium projects (Java only). 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.

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 LeanFT 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.

Set up Java SDK

The following procedure is relevant only for Java.

Maven-based projects only:

  1. Run the following command to download the relevant JAR files from the LeanFT Java SDK folder to your organization's repository:

    mvn deploy:deploy-file -DgroupId=com.hpe.lft -DartifactId=selenium-sdk -Dversion=14.0.0 -Dpackaging=jar -Dfile=<path-to-file> -DrepositoryId=<id-to-map-on-server-section-of-settings.xml> -Durl=<url-of-the-repository-to-deploy>

  1. Run this command for each JAR, using the appropriate values:

    JAR Values
    SDK

    Path to file:

    • Windows: <LeanFTInstallation>\Selenium SDK\Java\com.hpe.lft.selenium.jar
    • Linux: <LeanFTInstallation>/selenium-sdk/Java/com.hpe.lft.selenium.jar
    • Mac: <LeanFTInstallation>/Selenium SDK/Java/com.hpe.lft.selenium.jar

    Javadoc

    Path to file:

    • Windows:<LeanFTInstallation>\Selenium SDK\Java\com.hpe.lft.selenium-javadoc.jar
    • Linux: <LeanFTInstallation>/selenium-sdk/Java/com.hpe.lft.selenium-javadoc.jar
    • Mac: <LeanFTInstallation>/Selenium SDK/Java/com.hpe.lft.selenium-javadoc.jar

    Add the following switch to the command: -Dclassifier=Javadoc

Non-Maven based projects:

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.

Set up JavaScript SDK

The following procedure is relevant only for JavaScript.

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

    OS Script Path
    Windows js_installation.bat

    <LeanFT installation folder>\Selenium SDK\JavaScript\

    Linux

    js_installation.sh

    <LeanFT installation folder>/selenium-sdk/JavaScript/

    Mac js_installation.sh <LeanFT installation folder>/Selenium SDK/JavaScript/

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

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

    npm install selenium-webdriver

Back to top

Create a Java Selenium project

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

    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.

  2. Implement your test as you would any other Selenium test:

    Use the Selenium SDK and the LeanFT Selenium SDK (Java)

    The SDK includes 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