Skip to main content
Version: 9.0.0

Label

It is possible to find label element by following attributes:

NameParameter(s)TypeDescription
labeldataTestIdstringSearches for a label by value of a Pega data-test-id attribute, same as labelByTestId
container?string
labelByDataTestIddataTestIdstringSearches for a label by value of a Pega data-test-id attribute, same as label
container?string
labelByAttributeattributeNamestringSearches for a label by an attribute name and value
attributeValuestring
container?string
labelByCsscssstringSearches for a label by a custom scc selector
labelByXPathxpathstringSearches for a label by a custom xpath selector
container?string

Assertions

Assertions include many methods for filtering by index because quite often readonly text fields have the same data-test-ids and it`s difficult to differentiate them.

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists and is visible
shouldBeVisibleByIndexindexnumberChecks if the element exists and visible by a given index
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldExistoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists
shouldNotBeVisibleoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element exists but is not visible
shouldNotBeVisibleByIndexindexnumberChecks if the element exists but is not visible by a given index
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotExistoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element does not exist
shouldHaveTextvaluestringChecks if the element's inner text contains a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldHaveTextByIndexvaluestringChecks if the element's inner text by a given index contains a given string
indexnumber
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveTextvaluestringChecks if the element's inner text does not contain a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveTextByIndexvaluestringChecks if the element's inner text by a given index does not contain a given string
indexnumber
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldHaveExactTextvaluestringChecks if the element's inner text is equal to a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldHaveExactTextByIndexvaluestringChecks if the element's inner text by a given index is equal to a given string
indexnumber
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveExactTextvaluestringChecks if the element's inner text is not equal to a given string
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotHaveExactTextByIndexvaluestringChecks if the element's inner text by a given index is not equal to a given string
indexnumber
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }
shouldNotBeBlankoptions?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }Checks if the element's inner text is not equal to an empty string ("")
shouldNotBeBlankByIndexindexnumberChecks if the element's inner text by a given index is not equal to an empty string ("")
options?{ timeout?: number, assertionTimeout?: number, interval?: number, retries?: number, soft?: boolean }

Wait for functions

Simple wait for visibility functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element not to exist

Complex wait for visibility functions

Allow filtering of available elements by index, text, attribute:

NameParameter(s)TypeDescription
waitUntilVisibilityByTexttextstringFilters collection of elements by text and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByAttributeattributeNamestringFilters collection of elements by attribute and waits for the element to be visible
attributeValuestring
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilVisibilityByIndexindexnumberFilters collection of elements by index and waits for the element to be visible
options?{ timeout?: number, interval?: number, retries?: number }
waitUntilInvisibilityByIndexindexnumberFilters collection of elements by index and waits for the element not to be visible
options?{ timeout?: number, interval?: number, retries?: number }

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.label('Label').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

IsVisible and IsExists functions

NameParameter(s)TypeDescription
isVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists and is visible
isExistoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists

GetText function

NameParameter(s)TypeDescription
getTextReturns element's inner text as a string