By Class

LFTForSelenium.By

Contains all UFT Developer for Selenium By methods for locating elements.

Syntax

new By()

any

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

Syntax

any(bys)

Parameters

NameTypeDescription
bysArray.<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

NameTypeDescription
attributesObjectThe 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

NameTypeDescription
bysArray.<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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

className(className)

Parameters

NameTypeDescription
classNameRegExpThe 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 (attributes, tags, styles etc.).

Syntax

each(bys)

Parameters

NameTypeDescription
bysArray.<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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

id(id)

Parameters

NameTypeDescription
idRegExpThe 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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

linkText(linkText)

Parameters

NameTypeDescription
linkTextRegExpThe 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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

name(name)

Parameters

NameTypeDescription
nameRegExpThe 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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

role(role)

Parameters

NameTypeDescription
roleRegExpThe 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

NameTypeDescription
stylesObjectThe 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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

tagName(tagName)

Parameters

NameTypeDescription
tagNameRegExpThe 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 UFT Developer locator is used only when the value passed is a regular expression. Otherwise, the Selenium locator is used.

Syntax

type(type)

Parameters

NameTypeDescription
typeRegExpThe 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

NameTypeDescription
visibleBooleanWhether 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

NameTypeDescription
textStringThe text by which the elements are identified.

Returns

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