Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PageElementBase<Store>

This class provides basic functionalities for all PageElements.

template

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

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • new PageElementBase(selector: string, __namedParameters: object): PageElementBase

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 _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: PageElementBaseCurrently<Store, this>

Abstract eventually

eventually: PageElementBaseEventually<Store, this>

Abstract wait

wait: PageElementBaseWait<Store, this>

Accessors

$

  • get $(): 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.

    Returns Store

__lastDiff

  • get __lastDiff(): IDiff

Methods

Abstract __any

  • __any(actual: any): boolean

Abstract __contains

  • __contains(actual: any, expected: any): boolean
  • Compares the values of actual and expected and returns true if actual contains expected.

    Parameters

    • actual: any

      the actual value to be compared

    • expected: any

      the expected value to be compared

    Returns boolean

Abstract __equals

  • __equals(actual: any, expected: any): 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

Abstract __typeToString

  • __typeToString(value: any): string

__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

getInterval

  • getInterval(): number

getSelector

  • getSelector(): string

getTimeout

  • getTimeout(): number

toJSON

Generated using TypeDoc