You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

com.microfocus.adm.leanft:leanft-selenium-java-sdk

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.microfocus.adm.leanft:leanft-selenium-java-sdk

LeanFT Selenium Java SDK extends the WebDriver API with additional locators and utilities


Version published
Maintainers
2

Readme

Source

leanft-selenium-java-sdk

LeanFT for Selenium Java SDK

LeanFT for Selenium Java SDK extends the Selenium WebDriver API with locators and utilities that enable creating tests that are more robust, and reduces Selenium test automation and maintenance efforts.

Install

<dependency>
  <groupId>com.microfocus.adm.leanft</groupId>
  <artifactId>leanft-selenium-java-sdk</artifactId>
  <version>1.0.1</version>
</dependency>

Usage Example

LeanFT's By class extends the original Selenium By class. To use it, import the following:

import com.hpe.leanft.selenium.By;
import com.hpe.leanft.selenium.ByEach;
import com.hpe.leanft.selenium.Utils;

The following example demonstrates locating elements by their visible text.

        WebDriver driver = new ChromeDriver();
        driver.get("http://www.google.com");

        WebElement element = driver.findElement(By.visibleText("Google Search"));
        element.click();

        driver.quit();

The following example demonstrates locating elements using a regular expression.

        WebDriver driver = new ChromeDriver();
        driver.get("http://www.google.com");

        WebElement element = driver.findElement(By.name(Pattern.compile("^btn")));
        element.click();

        driver.quit(); 

Locate an element using its HTML attributes and highlight it.

       WebDriver driver = new ChromeDriver();
        driver.get("http://www.google.com");

        Map<String, String> attributes = new HashMap<>();
        attributes.put("class", "gsfi lst-d-f");
        attributes.put("id", "lst-ib");

        WebElement element = driver.findElement(By.attributes(attributes));
        element.click();

        driver.quit();

API

LeanFT for Selenium API reference documentation can be found here

New Locators

By.visibleText

Finds elements based on their visible text.

By.visible

Finds elements based on their visibility.

By.role

Finds elements based on their role.

By.type

Finds elements based on their type.

By.attributes

Finds elements based on their attributes (one or more). Attribute values can be defined using regular expressions.

By.styles

Finds elements based on their computed style (one or more). Computed style values can be defined using regular expressions.

By.each

Finds elements based on the combination of locators (attributes, tags, styles etc.).

Regular Expression Support

All the locators which accept a string as a value of the element's property were extended to support regular expressions, including the following Selenium native locators:

  • By.id
  • By.className
  • By.linkText
  • By.name
  • By.tagName

Utilities

Utils.getSnapshot

Returns a snapshot (image) of the selenium element as a Base64 string.

Utils.highlight

Highlights the selenium element in the browser.

build

To build the project, clone it and run the following command:

mvn clean install

FAQs

Package last updated on 27 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc