Class Locator

An element locator.

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(using: string, value: string): Locator

An element locator.

constructor

Parameters

  • using: string

    The type of strategy to use for this locator.

  • value: string

    The search target of this locator.

Returns

Locator

Properties

public static Strategy: ILocatorStrategy

Factory methods for the supported locator strategies.

type

{Object.}

public using: string

The search strategy to use when searching for an element.

type

{string}

public value: string

The search target for this locator.

type

{string}

Methods

public static checkLocator(locator: Locator): Locator

Verifies that a {@code locator} is a valid locator to use for searching for elements on the page.

Parameters

  • locator: Locator

    The locator to verify, or a short-hand object that can be converted into a locator to verify.

Returns

Locator

The validated locator.

public static checkLocator(obj: any): Locator

Parameters

  • obj: any

Returns

Locator

public static createFromObj(obj: any): Locator

Creates a new Locator from an object whose only property is also a key in the {@code webdriver.Locator.Strategy} map.

Parameters

  • obj: any

    The object to convert into a locator.

Returns

Locator

The new locator object.

public toString(): string

Returns

string

String representation of this locator.