Git Product home page Git Product logo

nemo-drivex's Introduction

nemo-drivex

Selenium webdriver extensions for Nemo automation framework. Adapts JSON-formatted locator objects to common selenium-webdriver operations.

Unless you plan to get your hands dirty and author your own 'view' plugin (see nemo-view), you probably won't be interacting with nemo-drivex directly, besides adding it as a dependency and adding it to your nemo-plugins.json config. If you are planning to use nemo-view, just start with the docs there.

Register as "drivex" (see below)

Build Status

Installation

  1. Please install nemo to your project as described here: https://github.com/paypal/nemo/blob/master/README.md
  2. Add this plugin to your package.json dev dependencies ("nemo-drivex": "^0.3.0")
  3. npm install
  4. add nemo-drivex to your config/nemo-plugins.json file
{
	"plugins": {
		"drivex": {
			"module": "nemo-drivex",
			"register": true
		}
	}
}

Locator explanation

The JSON locators expected by nemo-drivex would look like this:

{
  "locator": "#result .result",
  "type": "id"
}

type would be any of the accepted locator strategies of the current version of selenium-webdriver: e.g. id, name, css, className, linkText, partialLinkText

locator would be the string which would locate the element(s) via the selected strategy

##Example usage

var resultEl = nemo.drivex.find({'locator': '#result .result', 'type': 'css'});

//resultEl will be a selenium-webdriver promise, which will resolve to a found element or null

Debugging

nemo-drivex uses the debug module. For detailed debug messages, set DEBUG=nemo-drivex to the running process.

API

Methods

allDisabled(elements) → {Promise}

Determine if all WebElements in elements array are disabled
Parameters:
Name Type Description
elements

Array

array of WebElements
Returns:
promise resolves to true or Error
Type

Promise

allDisplayed(elements) → {Promise}

Determine if all WebElements in elements array are visible
Parameters:
Name Type Description
elements

Array

array of WebElements
Returns:
promise resolves to true or Error
Type

Promise

allEnabled(elements) → {Promise}

Determine if all WebElements in elements array are enabled
Parameters:
Name Type Description
elements

Array

array of WebElements
Returns:
promise resolves to true or Error
Type

Promise

allHidden(elements) → {Promise}

Determine if all WebElements in elements array are hidden
Parameters:
Name Type Description
elements

Array

array of WebElements
Returns:
promise resolves to true or Error
Type

Promise

find(locator, el) → {Promise}

wraps Selenium WebDriver/WebElement.findElement
Parameters:
Name Type Description
locator

LocatorJSON

el

WebElement

Returns:
resolves to WebElement or rejected
Type

Promise

finds(locator, el) → {Promise}

wraps Selenium WebDriver/WebElement.findElements
Parameters:
Name Type Description
locator

LocatorJSON

el

WebElement

Returns:
resolves to an array of WebElements or rejected
Type

Promise

oneDisplayed(elements) → {Promise}

determine if only one of the WebElements in the elements array is visible
Parameters:
Name Type Description
elements

Array

array of WebElements
Returns:
promise resolves to single visible element from "elements" or Error
Type

Promise

present(locator, el) → {Promise}

wraps Selenium WebDriver/WebElement.isElementPresent
Parameters:
Name Type Description
locator

LocatorJSON

el

WebElement

Returns:
resolves to true or rejected
Type

Promise

waitForElement(locator, timeout) → {Promise}

Wait for timeout milliseconds for the WebElement to be present
Parameters:
Name Type Description
locator

LocatorJSON

timeout

Number

Returns:
resolves to true or throw error
Type

Promise

waitForElementVisible(locator, timeout) → {Promise}

Wait for timeout milliseconds for the WebElement to be visible
Parameters:
Name Type Description
locator

LocatorJSON

timeout

Number

Returns:
resolves to true or throw error
Type

Promise

Special Objects

LocatorJSON

Type:
  • object

Properties:
Name Type Description
locator

string

a locator string, such as "[value='US']" or "#countrySelect"
type

string

corresponds to one of the Selenium Locator strategies (id, name, xpath, css)

nemo-drivex's People

Contributors

grawk avatar nikulkarni avatar duaneobrien avatar gabrielcsapo avatar pshakya avatar

Watchers

rosa maria palacios juncosa avatar  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.