Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValuePageElementGroup<Store, Content>

ValuePageElementGroup extends PageElementGroup with the possibility to set, retrieve and check the values of ValuePageElements, ValuePageElementLists and ValuePageElementMaps managed by ValuePageElementGroup.

template

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

template

Content an arbitrary object structure of PageNode instances as values and the names used to identify these PageNodes as keys

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _$

_$: Content

Protected _id

_id: string

Protected _lastDiff

_lastDiff: IDiff

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

currently

currently: ValuePageElementGroupCurrently<Store, Content, this>

eventually

eventually: ValuePageElementGroupEventually<Store, Content, this>

wait

wait: ValuePageElementGroupWait<Store, Content, this>

Accessors

$

  • get $(): Content

__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

Protected _includedInFilter

  • _includedInFilter(value: any): boolean

eachCheck

  • eachCheck<NodeInterface, ExpectedType>(supportsInterface: function, checkFunc: function, expected?: ExpectedType, isFilterMask?: boolean): boolean
  • Invokes a state check function for each PageNode in PageElementGroup's Content and returns true if the result of each state check function invocation was true.

    template

    NodeInterface needs to be implemented by all PageNodes for which checkFunc should be invoked

    template

    ExpectedType type of the structure of expected values

    Type parameters

    • NodeInterface

    • ExpectedType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke checkFunc

    • checkFunc: function

      is a state check function executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and either the PageNode's expected value used by the state check comparison or the PageNode's optional (sub) filter mask.

        • (args: object): boolean
        • Parameters

          • args: object
            • Optional expected?: ExpectedType[keyof ExpectedType]
            • Optional filter?: ExpectedType[keyof ExpectedType]
            • node: NodeInterface

          Returns boolean

    • Optional expected: ExpectedType

      a structure of expected values used for the state check comparisons

    • Default value isFilterMask: boolean = false

      If set to true, the expected parameter represents a filterMask which can be used to skip the invocation of the state check function for some or all PageNodes.

    Returns boolean

    a boolean indicating whether the result of each state check function invocation was true

eachCompare

  • eachCompare<NodeInterface, ExpectedType, ResultType>(supportsInterface: function, compareFunc: function, expected?: ExpectedType, isFilterMask?: boolean): ResultType
  • Invokes a state check function for each PageNode in PageElementGroup's Content and returns a structure of state check function results.

    template

    NodeInterface needs to be implemented by all PageNodes for which compareFunc should be invoked

    template

    ExpectedType type of the structure of expected values

    template

    ResultType type of the structure of state check function results

    Type parameters

    • NodeInterface

    • ExpectedType: Partial<Content>

    • ResultType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke compareFunc

    • compareFunc: function

      is a state check function executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and either the PageNode's expected value used by the state check comparison or the PageNode's optional (sub) filter mask.

        • (args: object): any
        • Parameters

          • args: object
            • Optional expected?: ExpectedType[keyof ExpectedType]
            • Optional filter?: ExpectedType[keyof ExpectedType]
            • node: NodeInterface

          Returns any

    • Optional expected: ExpectedType

      a structure of expected values used for the state check comparisons

    • Default value isFilterMask: boolean = false

      If set to true, the expected parameter represents a filterMask which can be used to skip the invocation of the state check function for some or all PageNodes.

    Returns ResultType

    a structure of results of a state check function executed for each PageNode in PageElementGroup's Content

eachDo

  • eachDo<NodeInterface, FilterType>(supportsInterface: function, action: function, filterMask?: FilterType): this
  • Invokes an action for each PageNode in PageElementGroup's Content.

    template

    NodeInterface needs to be implemented by all PageNodes for which action should be invoked

    template

    FilterType type of a filter mask which can be used to skip the invocation of an action for some or all PageNodes

    Type parameters

    • NodeInterface

    • FilterType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke action

    • action: function

      an action executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and the PageNode's optional (sub) filter mask.

        • (args: object): any
        • Parameters

          • args: object
            • Optional filter?: FilterType[keyof FilterType]
            • node: NodeInterface

          Returns any

    • Optional filterMask: FilterType

      can be used to skip the invocation of an action for some or all PageNodes.

    Returns this

    this (an instance of PageElementGroup)

eachGet

  • eachGet<NodeInterface, ResultType, FilterType>(supportsInterface: function, getFunc: function, filterMask?: FilterType): ResultType
  • Invokes a state retrieval function for each PageNode in PageElementGroup's Content and returns a structure of state retrieval function results.

    template

    NodeInterface needs to be implemented by all PageNodes for which getFunc should be invoked

    template

    ResultType type of the structure of state retrieval function results

    template

    FilterType type of a filter mask which can be used to skip the invocation of the state retrieval function for some or all PageNodes

    Type parameters

    • NodeInterface

    • ResultType: Partial<Content>

    • FilterType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke getFunc

    • getFunc: function

      is a state retrieval function executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and the PageNode's optional (sub) filter mask.

        • (args: object): any
        • Parameters

          • args: object
            • Optional filter?: FilterType[keyof FilterType]
            • node: NodeInterface

          Returns any

    • Optional filterMask: FilterType

      can be used to skip the invocation of the state retrieval function for some or all PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns ResultType

    a structure of results of a state retrieval function executed for each PageNode in PageElementGroup's Content

eachSet

  • eachSet<NodeInterface, ValuesType>(supportsInterface: function, setFunc: function, values: ValuesType): this
  • Invokes a setter function for each PageNode in PageElementGroup's Content.

    template

    NodeInterface needs to be implemented by all PageNodes for which setFunc should be invoked

    template

    ValuesType type of the structure of setter values

    Type parameters

    • NodeInterface: IPageNode

    • ValuesType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke setFunc

    • setFunc: function

      a setter function executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and the PageNode's value.

        • (args: object): NodeInterface
        • Parameters

          • args: object
            • node: NodeInterface
            • Optional value?: ValuesType[keyof ValuesType]

          Returns NodeInterface

    • values: ValuesType

      a structure of setter values

    Returns this

    this (an instance of PageElementGroup)

eachWait

  • eachWait<NodeInterface, ExpectedType>(supportsInterface: function, waitFunc: function, expected?: ExpectedType, isFilterMask?: boolean): this
  • Invokes a wait function for each PageNode in PageElementGroup's Content.

    template

    NodeInterface needs to be implemented by all PageNodes for which waitFunc should be invoked

    template

    ExpectedType type of the structure of expected values

    Type parameters

    • NodeInterface

    • ExpectedType: Partial<Content>

    Parameters

    • supportsInterface: function

      this function checks if a PageNode implements the NodeInterface required to invoke waitFunc

    • waitFunc: function

      is a wait function executed for each PageNode in PageElementGroup's Content. It is passed an args object containing the PageNode and either the PageNode's expected value used by the wait condition or the PageNode's optional (sub) filter mask.

        • (args: object): NodeInterface
        • Parameters

          • args: object
            • Optional expected?: ExpectedType[keyof ExpectedType]
            • Optional filter?: ExpectedType[keyof ExpectedType]
            • node: NodeInterface

          Returns NodeInterface

    • Optional expected: ExpectedType

      a structure of expected values used for the wait conditions

    • Default value isFilterMask: boolean = false

      If set to true, the expected parameter represents a filterMask which can be used to skip the invocation of the wait function for some or all PageNodes.

    Returns this

    this (an instance of PageElementGroup)

getContainsDirectText

  • Returns the 'containsDirectText' status of all PageNodes managed by PageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    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

    • directTexts: ExtractTextStateChecker<Content>

      the expected direct texts used in the comparisons which set the 'containsDirectText' status

    Returns object

getContainsText

getContainsValue

  • Returns the 'containsValue' status of all PageNodes managed by ValuePageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    A ValuePageElement's 'containsValue' status is set to true if its actual value contains the expected value.

    Parameters

    • values: ExtractValueStateChecker<Content>

      the expected values used in the comparisons which set the 'containsValue' status

    Returns object

getDirectText

  • Returns the direct texts of all PageNodes managed by PageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    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

    • Optional filterMask: GroupFilterMask<Content>

      can be used to skip the invocation of the getDirectText function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getHasAnyDirectText

  • Returns the 'hasAnyDirectText' status of all PageNodes managed by PageElementGroup as a result structure after performing the initial waiting condition of each PageNode.

    A PageElement's 'hasAnyDirectText' status is set to true if the PageElement has any 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

    • Optional filterMask: GroupFilterMask<Content>

      can be used to skip the invocation of the getHasAnyDirectText function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getHasAnyText

  • Returns the 'hasAnyText' status of all PageNodes managed by PageElementGroup as a result structure after performing the initial waiting condition of each PageNode.

    A PageElement's 'hasAnyText' status is set to true if the PageElement has any text.

    Parameters

    • Optional filterMask: GroupFilterMask<Content>

      can be used to skip the invocation of the getHasAnyText function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getHasAnyValue

  • Returns the 'hasAnyValue' status of all PageNodes managed by ValuePageElementGroup as a result structure after performing the initial waiting condition of each PageNode.

    A ValuePageElement's 'hasAnyValue' status is set to true if the ValuePageElement has any value.

    Parameters

    • Optional filterMask: ValueGroupFilterMask<Content>

      can be used to skip the invocation of the getHasAnyValue function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getHasDirectText

  • Returns the 'hasDirectText' status of all PageNodes managed by PageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    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

    • directTexts: ExtractTextStateChecker<Content>

      the expected direct texts used in the comparisons which set the 'hasDirectText' status

    Returns object

getHasText

getHasValue

  • Returns the 'hasValue' status of all PageNodes managed by ValuePageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    A ValuePageElement's 'hasValue' status is set to true if its actual value equals the expected value.

    Parameters

    Returns object

getIsEnabled

  • Returns the 'enabled' status of all PageNodes managed by PageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    Parameters

    • Optional filterMask: GroupFilterMask<Content>

      can be used to skip the invocation of the getIsEnabled function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getText

  • Returns the texts of all PageNodes managed by PageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    Parameters

    • Optional filterMask: GroupFilterMask<Content>

      can be used to skip the invocation of the getText function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

getValue

  • Returns the values of all PageNodes managed by ValuePageElementGroup as a result structure after executing the initial waiting condition of each PageNode.

    Parameters

    • Optional filterMask: ValueGroupFilterMask<Content>

      can be used to skip the invocation of the getValue function for some or all managed PageNodes. The results of skipped function invocations are not included in the total results structure.

    Returns object

setValue

toJSON

Generated using TypeDoc