Testing with Selenium
OpenText Functional Testing for Developers (Selenium) is a solution that extends the Selenium API, increasing productivity and enabling you to create more robust and more maintainable Selenium tests.
Introduction
OpenText Functional Testing for Developers (Selenium) includes the following:
-
.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:
- OpenText Functional Testing for Developers (Selenium) is supported on Windows, Linux, and Mac environments.
- OpenText Functional Testing for Developers (Selenium) supports running your tests with Selenium Grid.
The OpenText Functional Testing for Developers (Selenium) SDKs are available as open source projects in GitHub:
Before you start
This section explains how to prepare for using Selenium with the OpenText Functional Testing for Developers (Selenium) extension.
Install and configure browsers and relevant Selenium WebDriver drivers
-
Log into the OpenText Functional Testing for Developers machine as an administrator.
-
Install the browsers that you plan to work 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.
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 OpenText Functional Testing for Developers 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 test folder for Selenium
To create a JavaScript test folder that uses the OpenText Functional Testing for Developers (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 test project for Selenium
To create a Java project that uses the OpenText Functional Testing for Developers (Selenium) SDK, do one of the following:
Create a project using the templates for Selenium
In your IDE, create a new Selenium project using the New Project wizard. For details, see Create a 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 OpenText Functional Testing for Developers and Selenium libraries.
Add the OpenText Functional Testing for Developers (Selenium) Java SDK to an existing Java Maven project
Add the following dependencies to your pom.xml file with the relevant version numbers:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId> <version>4.0.0</version> </dependency> <dependency> <groupId>com.microfocus.adm.leanft</groupId> <artifactId>leanft-selenium-java-sdk</artifactId> <version>1.0.2</version> </dependency>
Create a .NET test project for Selenium
To create a .NET project that uses the OpenText Functional Testing for Developers (Selenium), 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 OpenText Functional Testing for Developers libraries.
Note: To use the following templates, built with .NET 6 or 7, you must be working with Selenium version 4.9 or later:
-
UFT Developer Selenium MsTest Project
-
UFT Developer Selenium NUnit 3 Project
-
-
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 OpenText Functional Testing for Developers (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 OpenText Functional Testing for Developers (Selenium) package or project, implement your test as you would any other Selenium test.
Use the Selenium SDK and the relevant OpenText Functional Testing for Developers (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 SDKs for extending Selenium.
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.