Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PageNode<Store>

This class serves as a base class for all PageElements, PageElementLists, PageElementMaps and PageElementGroups.

template

Store type of the PageNodeStore used by PageNode to retrieve PageNodes from the store

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • PageNode serves as a base class for all PageElements, PageElementLists, PageElementMaps and PageElementGroups.

    Parameters

    • selector: string

      the raw XPath selector of the PageNode

    • opts: IPageNodeOpts<Store>

      the options used to configure an instance of PageNode

    Returns PageNode

Properties

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

Abstract currently

currently: PageNodeCurrently<Store, this>

defines an api for all functions of PageNode which check if a condition is currently true or which retrieve a current value from the tested application's state

Abstract eventually

eventually: PageNodeEventually<Store, this>

defines an api for all functions of PageNode which check if a condition eventually becomes true within a specified timeout

Abstract wait

wait: PageNodeWait<Store, this>

defines an api for all functions of PageNode which wait for a condition to become true within a specified timeout

Accessors

__lastDiff

  • get __lastDiff(): IDiff

Methods

__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

__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 _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

toJSON

Generated using TypeDoc