Namespace: webdriver
View Source

# class Locator

An element locator.

## new Locator(using, value)

Parameters

using`string`

  The type of strategy to use for this locator.

value`string`

  The search target of this locator.

## Instance Methods

### toString()code »

Returns

`string`

## Instance Properties

using `string`

  The search strategy to use when searching for an element.

value `string`

  The search target for this locator.

## Static Functions

### Locator.checkLocator(value)code »

Verifies that a `value` is a valid locator to use for searching for elements on the page.

Parameters

value`*`

  The value to check is a valid locator.

Returns

`(webdriver.Locator|Function)`

  A valid locator object or function.

Throws

`TypeError`

  If the given value is an invalid locator.

## Static Properties

Locator.Strategy `Object<string, function(string): (Function|webdriver.Locator)>`

  Maps `webdriver.By.Hash` keys to the appropriate factory function.