Giter Club home page Giter Club logo

robula-plus's Introduction

Robula+

Robula+ is an algorithm to generate robust XPath-based locators, that are likely to work correctly with new releases of a web application. Robula+ reduces the locators' fragility on average by 90% w.r.t. absolute locators and by 63% w.r.t. Selenium IDE locators [1].

Build Status Codecov Coverage

Usage

The code mainly contains of the three following Methods:

getRobustXPath(element, document):

Returns an optimized robust XPath locator string, describing a desired element.

Parameter Type Description
element Element The desired element.
document Document The document to analyse, that contains the desired element.

getElementByXPath(xPath, document):

Returns the first element in the given document located by the given xPath locator.

Parameter Type Description
xPath string An xPath string, describing the desired element.
document Document The document to analyse, that contains the desired element.

uniquelyLocate(xPath, element, document):

Returns true, if the xPath describes only the desired element.

Parameter Type Description
xPath string An xPath string, describing the desired element.
element Element The desired element.
document Document The document to analyse, that contains the desired element.

Example

Get a robust XPath from an absolute XPath:

import { RobulaPlus } from "robula-plus";

let robulaPlus = new RobulaPlus();
let element = robulaPlus.getElementByXPath('/html/body/div/span/a', document);
robulaPlus.getRobustXPath(element, document);

Installation

Note: The License of this code needs some clarification, so until then there will be no public install package available. If you want to use the code, you have to clone and build it manually, as described in the steps below:

  1. Download a current version of Node.js.
  2. To clone this repository, type:
git clone https://github.com/cyluxx/robula-plus.git
  1. Navigate to the directory, and install dependencies:
cd robula-plus
npm install
  1. To build the code, run:
npm run build

You now should have a lib folder, that you can include in your private JavaScript / TypeScript project.

About

Authors: Maurizio Leotta, Andrea Stocco, Filippo Ricca and Paolo Tonella.

This TypeScript Implementation by: @Cyluxx

For more information on how the algorithm works, please refer to:

[1] Maurizio Leotta, Andrea Stocco, Filippo Ricca, Paolo Tonella. ROBULA+: An Algorithm for Generating Robust XPath Locators for Web Testing. Journal of Software: Evolution and Process (JSEP), Volume 28, Issue 3, pp.177โ€“204.John Wiley & Sons, 2016. https://doi.org/10.1002/smr.1771

robula-plus's People

Contributors

cyluxx avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.