UFT Developer for Selenium
UFT Developer 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
UFT Developer 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, JBoss Developer Studio, or 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 (OIC) for Selenium.
Note:
- UFT Developer for Selenium is supported on Windows, Linux, and Mac environments.
- UFT Developer for Selenium supports running your tests with Selenium Grid.
The UFT Developer for Selenium SDKs are available as open source projects in GitHub:
Before you start
To prepare for using Selenium with the UFT Developer for Selenium extension, do the following:
Install and configure browsers and relevant Selenium WebDriver drivers
-
Log into the UFT Developer machine as an administrator.
-
Install the browsers that you will be working with in their default installation locations. For supported browsers for Selenium, see the Support Matrix.
-
Download and extract the Selenium WebDriver drivers relevant for your browsers. See the Selenium website.
Note:
- For supported WebDriver drivers, see the Support Matrix.
- Firefox requires a WebDriver driver from version 48 and later.
-
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 without Maven, download the Selenium JAR files to the UFT Developer 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.
Create a JavaScript 'UFT Developer for Selenium' test folder
To create a JavaScript test folder that uses the UFT Developer for Selenium SDK, follow these steps:
- Create a folder (in any location) for the tests that you will create.
-
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.
-
Install the selenium node module. From the test folder, run the following command:
npm install selenium-webdriver
Create a Java 'UFT Developer for Selenium' project
To create a Java project that uses the UFT Developer for Selenium SDK, do one of the following:
Create a project using the UFT Developer for Selenium templates
In your IDE, create a new Selenium project using the New Project wizard. For details, see Create a UFT Developer testing project or module.
- Select Selenium.
- For non-Maven-based projects, provide the path to the Selenium JAR files.
The project is created with all the required UFT Developer and Selenium libraries.
Add the UFT Developer 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>
Create a .NET 'UFT Developer for Selenium' project
To create a .NET project that uses the UFT Developer for Selenium SDK, do one of the following:
Create a project using the UFT Developer for Selenium templates
-
In Visual Studio, create a UFT Developer for Selenium project using the New Project wizard.
The project is created with all the required UFT Developer libraries.
-
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 UFT Developer 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.
Implement your Selenium test
After setting up your UFT Developer for Selenium package or project, implement your test as you would any other Selenium test.
Use the Selenium SDK and the relevant UFT Developer 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
For details, see UFT Developer for Selenium SDKs.
Use the Object Identification Center (OIC) for Selenium
To identify (spy) objects in your application and easily generate a description code for this element to be used in your test.
For details, see Object Identification Center (OIC) for Selenium.