Share this page

# By Class

LFTForSelenium.By

Contains all OpenText Functional Testing for Developers (Selenium) By methods for locating elements.

Syntax

`new By()`

In this topic:

## any

Returns a function that locates and returns elements that match at least one of the locators provided (OR).

Syntax

    any(bys)

Parameters

Name | Type | Description
--- | --- | ---
`bys` | Array.<Object> | At least one of these locators are used to identify the elements.

Returns

A function that locates and returns elements that match at least one of the provided locators.

Back to top

## attribute

Returns a function that locates and returns elements according to the provided attributes. You can also use regular expressions.

Syntax

    attributes(attributes)

Parameters

Name | Type | Description
--- | --- | ---
`attributes` | Object | The attributes by which the elements are identified.

Returns

A function that locates and returns elements with matching attributes.

Back to top

## chained

Returns a function that locates and returns elements by using locators that describe the elements and their ancestors (higher level elements).

Syntax

    chained(bys)

Parameters

Name | Type | Description
--- | --- | ---
`bys` | Array.<Object> | A list of locators, each representing a level in the hierarchy, starting with the highest level.

Returns

A function that locates and returns elements nested within the hierarchy that contains the provided locators.

Back to top

## className

Returns a function that locates and returns elements with the provided className parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    className(className)

Parameters

Name | Type | Description
--- | --- | ---
`className` | RegExp | The className of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given className.

Back to top

## each

Returns a function that locates and returns elements according to one or more locators (for example, attributes, tags, or styles).

Syntax

    each(bys)

Parameters

Name | Type | Description
--- | --- | ---
`bys` | Array.<Object> | The locators (Bys) by which the elements are identified.

Returns

A function that locates and returns elements that matches all the locators.

## id

Returns a function that locates and returns elements with the provided ID parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    id(id)

Parameters

Name | Type | Description
--- | --- | ---
`id` | RegExp | The ID of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given ID.

## linkText

Returns a function that locates and returns elements with the provided linkText parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    linkText(linkText)

Parameters

Name | Type | Description
--- | --- | ---
`linkText` | RegExp | The linkText of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given linkText.

## name

Returns a function that locates and returns elements with the provided name parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    name(name)

Parameters

Name | Type | Description
--- | --- | ---
`name` | RegExp | The name of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given name.

## role

Returns a function that locates and returns elements with the provided role parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    role(role)

Parameters

Name | Type | Description
--- | --- | ---
`role` | RegExp | The role of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given role.

## styles

Returns a function that locates and returns elements according to one or more styles. You can also use regular expressions.

Syntax

    styles(styles)

Parameters

Name | Type | Description
--- | --- | ---
`styles` | Object | The styles by which the elements are identified.

Returns

A function that locates and returns elements with matching styles.

## tagName

Returns a function that locates and returns elements with the provided tagName parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    tagName(tagName)

Parameters

Name | Type | Description
--- | --- | ---
`tagName` | RegExp | The tagName of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given tagName.

## type

Returns a function that locates and returns elements with the provided type parameter. The OpenText Functional Testing for Developers locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

    type(type)

Parameters

Name | Type | Description
--- | --- | ---
`type` | RegExp | The type of the elements in the form of a regular expression.

Returns

A function that locates and returns elements with the given type.

## visible

Returns a function that locates and returns elements that are either visible or not, depending on the parameter passed.

Syntax

    visible(visible)

Parameters

Name | Type | Description
--- | --- | ---
`visible` | Boolean | Whether the elements are visible.

Returns

A function that locates and returns elements that are either visible or not, depending on the parameter passed.

## visibleText

Returns a function that locates and returns elements with the provided visibleText parameter.

Syntax

    visibleText(text)

Parameters

Name | Type | Description
--- | --- | ---
`text` | String | The text by which the elements are identified.

Returns

A function that locates and returns elements that contains the visibleText.

Tips to improve your search results... OpenText™ Functional Testing for Developers (Selenium) JavaScript SDK All versions OpenText™ Functional Testing for Developers (Selenium) SDK 25.2 All View Local Help Center View Online Help Center Version: