Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValuePageElement<Store, ValueType>

ValuePageElement extends PageElement with the possibility to set, retrieve and check a PageElement's value.

It also adds another initial waiting condition:

  • 'value' to wait for an element to have any value
template

Store type of the PageNodeStore instance which can be used to retrieve/create PageNodes

template

ValueType the type of PageElement's value

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _$

_$: Store

_$ provides access to the PageNode retrieval functions of PageElementBase's PageNodeStore and prefixes the selectors of all PageNodes retrieved via _$ with the selector of PageElementBase.

Protected _customScroll

_customScroll: IScrollParams

stores the default custom scrolling behaviour

Protected _interval

_interval: number

the default interval used by PageElement for all of its functions that operate with intervals (eg. wait and eventually)

Protected _lastDiff

_lastDiff: IDiff

Stores the last differences of PageNode's check state functions.

Intended for framework-internal usage only.

Protected _selector

_selector: string

the XPath selector of PageNode

Protected _store

_store: Store

an instance of PageNodeStore which can be used to retrieve/create PageNodes

Protected _timeout

_timeout: number

the default timeout used by PageElement for all of its functions that operate with timeouts (eg. wait and eventually)

Protected _waitType

_waitType: WaitType

Defines the kind of wait condition performed when initialWait is invoked.

The initial wait condition is performed every time before an interaction with the tested application takes place via a PageElement's action (eg. click).

Abstract currently

currently: ValuePageElementCurrently<Store, this, ValueType>

eventually

eventually: ValuePageElementEventually<Store, this, ValueType>

wait

wait: ValuePageElementWait<Store, this, ValueType>

Accessors

$

  • get $(): Store

Protected __element

  • get __element(): Client<RawResult<Element>> & RawResult<Element>

__lastDiff

  • get __lastDiff(): IDiff

element

  • get element(): Client<RawResult<Element>> & RawResult<Element>

Methods

__any

  • __any(actual: any): boolean
  • Returns true if actual has any value.

    By default, the comparison is only implemented for the types string, number and boolean.

    If actual is of type number or boolean, this function always returns true unless the value of actual is undefined or null.

    If the implementation is missing for the type of actual, an error will be thrown.

    Parameters

    • actual: any

      an actual value retrieved from the page's state

    Returns boolean

__contains

  • __contains(actual: any, expected: any): boolean
  • Returns true if actual contains expected. Both actual and expected are supposed to be of the same type.

    By default, the comparison is only implemented for the type string. If the implementation is missing for the type of actual and expected, an error will be thrown.

    Parameters

    • actual: any

      an actual value retrieved from the page's state

    • expected: any

      an expected value

    Returns boolean

__equals

  • __equals(actual: any, expected: any): boolean
  • Returns true if actual equals expected. Both actual and expected are supposed to be of the same type.

    By default, the comparison is only implemented for the types string, number, boolean undefined and null.

    If the implementation is missing for the type of actual and expected, an error will be thrown.

    Parameters

    • actual: any

      an actual value retrieved from the page's state

    • expected: any

      an expected value

    Returns boolean

__eventually

  • __eventually(func: function): boolean
  • Provides custom error handling of 'could not be located' and 'WaitUntilTimeoutError' errors for functions that check if a condition returns true within a specific timeout.

    Parameters

    • func: function

      the function which is supposed to return true within a specific timeout

        • (): void
        • Returns void

    Returns boolean

__execute

  • __execute<ResultType>(func: function): ResultType
  • Executes func and trows any errors that occur during its execution.

    If an error occurs because an element could not be located on the page, throws a custom 'could not be located' error message.

    template

    ResultType the result type of the executed function

    Type parameters

    • ResultType

    Parameters

    • func: function

      the function to be executed

        • (): ResultType
        • Returns ResultType

    Returns ResultType

    the result value of the executed function

__getNodeId

  • __getNodeId(): string

__setLastDiff

  • __setLastDiff(diff: IDiff): void

__typeToString

  • __typeToString(value: any): any
  • Converts value to the type string.

    This function is used to write a value of an arbitrary type into error messages and log outputs.

    By default, the comparison is only implemented for the types string, number, boolean, undefined and for the value null.

    If the implementation is missing for the type of value, an error will be thrown.

    Parameters

    • value: any

      the value whose type should be converted

    Returns any

__wait

  • __wait(func: function, errorMessage: string, timeout: number): this
  • Provides custom error handling of 'could not be located' and 'WaitUntilTimeoutError' errors for functions that wait for a condition to become true within a specific timeout and throw an error if the condition does not become true.

    Parameters

    • func: function

      the function which is supposed to return true within a specific timeout and throws an error if the condition does not become true

        • (): boolean
        • Returns boolean

    • errorMessage: string

      an errorMessage that describes the condition which did not become true within a specific timeout

    • timeout: number

      the timeout used to wait for the result of the passed func to return true

    Returns this

    this (an instance of PageNode)

__waitUntil

  • __waitUntil(waitFunc: function, errorMessageFunc: function, timeout: number, interval?: number): this
  • This function executes a waitFunc until it returns true or a specific timeout is reached. If the return value of waitFunc does not become true within the timeout, this function throws a 'WaitUntilTimeoutError'.

    __waitUntil also provides custom error handling for 'could not be located' errors.

    Parameters

    • waitFunc: function

      the function which is supposed to return true within a specific timeout

        • (): boolean
        • Returns boolean

    • errorMessageFunc: function

      a function that returns an errorMessage which describes the condition that did not become true within a specific timeout

        • (): string
        • Returns string

    • timeout: number

      the timeout used to wait for the result of the waitFunc to return true

    • Optional interval: number

      the interval used to check for the result of the waitFunc to return true

    Returns this

    this (an instance of PageNode)

Protected _executeAfterInitialWait

  • _executeAfterInitialWait<ResultType>(func: function): ResultType
  • Executes func after initial wait and, if an error occurs during execution of func, throws a custom error message that the page element could not be located on the page.

    template

    ResultType the type of the executed function's result

    Type parameters

    • ResultType

    Parameters

    • func: function

      the function to be executed after performing the initial wait condition

        • (): ResultType
        • Returns ResultType

    Returns ResultType

Protected _handleWaitError

  • _handleWaitError(error: any, errorMessage: string, timeout: number): void
  • This function implements custom error handling for 'could not be located' and 'WaitUntilTimeoutError' errors.

    Parameters

    • error: any

      an arbitrary type of error

    • errorMessage: string

      used to describe the failed condition check which caused a WaitUntilTimeoutError

    • timeout: number

      the timeout used to wait for an element to be located or for a wait condition to return true

    Returns void

Protected _scrollTo

click

  • Clicks on PageElement after performing PageElement's initial waiting condition.

    Before clicking on PageElement, it is scrolled into the viewport.

    If the clicked HTML element is obscured by another HTML element, the click will be repeated until the clicked HTML element is no longer obscured and can therefore receive the click or until a specific timeout is reached.

    If a postCondition is defined in click's options, the click will be repeated until the postCondition function returns true or until a specific timeout is reached.

    Parameters

    • Default value opts: IClickOpts = {}

      includes options used to configure the behavior of the click function:

      • postCondition: If defined, a click on PageElement will be repeated until the result this function returns true.
      • customScroll: Overwrites the default custom scrolling behavior used by the click function.
      • timeout: Defines how long the PageElement can take to become clickable and the postCondition to be met.
      • interval: The interval used to wait for PageElement to become clickable and the postCondition to be met.

      If no timeout is specified, PageElement's default timeout is used. If no interval is specified, PageElement's default interval is used.

    Returns this

    this (an instance of PageElement)

getAttribute

  • getAttribute(attributeName: string): string

getClass

  • getClass(): string

getContainsDirectText

  • getContainsDirectText(directText: string): boolean
  • Returns a PageElement's 'containsDirectText' status after performing the initial waiting condition.

    A PageElement's 'containsDirectText' status is set to true if its actual direct text contains the expected direct text.

    A direct text is a text that resides on the level directly below the selected HTML element. It does not include any text of the HTML element's nested children HTML elements.

    Parameters

    • directText: string

      the expected direct text used in the comparison which sets the 'containsDirectText' status

    Returns boolean

getContainsText

  • getContainsText(text: string): boolean
  • Returns a PageElement's 'containsText' status after performing the initial waiting condition.

    A PageElement's 'containsText' status is set to true if its actual text contains the expected text.

    Parameters

    • text: string

      the expected text used in the comparison which sets the 'containsText' status

    Returns boolean

getContainsValue

  • getContainsValue(value: ValueType): boolean

getDirectText

  • getDirectText(): string
  • Returns PageElement's direct text after performing the initial waiting condition.

    A direct text is a text that resides on the level directly below the selected HTML element. It does not include any text of the HTML element's nested children HTML elements.

    Returns string

getHTML

  • getHTML(): string

getHasAnyDirectText

  • getHasAnyDirectText(): boolean

getHasAnyText

  • getHasAnyText(): boolean

getHasAnyValue

  • getHasAnyValue(): boolean

getHasDirectText

  • getHasDirectText(directText: string): boolean
  • Returns a PageElement's 'hasDirectText' status after performing the initial waiting condition.

    A PageElement's 'hasDirectText' status is set to true if its actual direct text equals the expected direct text.

    A direct text is a text that resides on the level directly below the selected HTML element. It does not include any text of the HTML element's nested children HTML elements.

    Parameters

    • directText: string

      the expected direct text used in the comparison which sets the 'hasDirectText' status

    Returns boolean

getHasText

  • getHasText(text: string): boolean
  • Returns a PageElement's 'hasText' status after performing the initial waiting condition.

    A PageElement's 'hasText' status is set to true if its actual text equals the expected text.

    Parameters

    • text: string

      the expected text used in the comparison which sets the 'hasText' status

    Returns boolean

getHasValue

  • getHasValue(value: ValueType): boolean

getHeight

  • getHeight(): number

getId

  • getId(): string

getInterval

  • getInterval(): number

getIsEnabled

  • getIsEnabled(): boolean

getLocation

getName

  • getName(): string

getSelector

  • getSelector(): string

getSize

getText

  • getText(): string

getTimeout

  • getTimeout(): number

getValue

  • getValue(): ValueType

getWidth

  • getWidth(): number

getX

  • getX(): number

getY

  • getY(): number

initialWait

  • initialWait(): this
  • Performs PageElement's initial waiting condition.

    Supports the following waiting types:

    • 'exist' to wait for an element to exist in the DOM
    • 'visible' to wait for an element to become visible (not obscured by other elements, not set to 'hidden'...)
    • 'text' to wait for an element to have any text
    • 'value' to wait for an element to have any value

    Returns this

    this (an instance of ValuePageElement)

scrollTo

Abstract setValue

  • setValue(value: ValueType): this

toJSON

Generated using TypeDoc