Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PageNodeStore

PageNodeStore serves as a facade for the creation and retrieval of Page Nodes. Basically, Page Nodes should only be created or retrieved via PageNodeStores and never by "manually" invoking their constructor functions.

PageNodeStore caches instances of Page Nodes with the same type and selector to avoid creating new Page Nodes on each invocation of a retrieval function.

Furthermore, PageNodeStore allows you to define default opts parameters and provide pre-configured variants of PageNodes (eg. Element and ExistElement).

Hierarchy

  • PageNodeStore

Index

Constructors

constructor

Properties

Protected _instanceCache

_instanceCache: object

Caches instances of PageNodes.

Type declaration

  • [id: string]: any

Protected _xPathBuilder

_xPathBuilder: XPathBuilder

An instance of XPathBuilder used to build the currently constructed XPath expressions of retrieved PageNodes.

Methods

Element

ElementGroup

  • Retrieves an instance of a PageElementGroup from the store.

    The group functions (state check -> hasXXX/hasAnyXXX/containsXXX, state retrieval -> getXXX) supported by the retrieved PageElementGroup are defined in Workflo.IElementNode.

    Type parameters

    Parameters

    • content: Content

      an object whose keys are the names of PageNodes managed by the PageElementGroup and whose values are instances of these PageNodes

    Returns PageElementGroup<this, Content>

    an instance of the retrieved PageElementGroup

ElementList

ElementMap

ExistElement

  • Retrieves an instance of a PageElement from the store.

    The waitType of the retrieved PageElement is set to 'exist' and cannot be overwritten.

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElement

    • Optional opts: Pick<IPageElementOpts<this>, Exclude<ElementPublicKeys, "waitType">>

      the publicly available options used to configure the retrieved PageElement

    Returns PageElement<this>

    an instance of the retrieved PageElement

ExistElementMap

Protected List

  • Retrieves an instance of a PageElementList from the store that manages any instance of PageElement which inherits from the PageElement class.

    The waitType of PageElements managed by PageElementList and the waitType of the list itself are set to 'visible' by default.

    template

    PageElementType the type of PageElement managed by PageElementList

    template

    PageElementOpts the type of the opts parameter passed to the constructor function of PageElements managed by PageElementList

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElementList

    • opts: Pick<IPageElementListOpts<this, PageElementType, PageElementOpts>, ListConstructorKeys>

      the publicly available options used to configure the retrieved PageElementList

    Returns PageElementList<this, PageElementType, PageElementOpts>

    an instance of the retrieved PageElementList

Protected Map

  • Retrieves an instance of a PageElementMap from the store that manages any instance of PageElement which inherits from the PageElement class.

    The waitType of PageElements managed by PageElementMap is set to 'visible' by default.

    template

    K the names of all PageElements managed by PageElementMap

    template

    PageElementType the type of PageElement managed by PageElementMap

    template

    PageElementOpts the type of the opts parameter passed to the constructor function of PageElements managed by PageElementMap

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElementMap

    • opts: Pick<IPageElementMapOpts<this, K, PageElementType, PageElementOpts>, MapConstructorKeys>

      the publicly available options used to configure the retrieved PageElementMap

    Returns PageElementMap<this, K, PageElementType, PageElementOpts>

    an instance of the retrieved PageElementMap

ValueGroup

  • Retrieves an instance of a ValuePageElementGroup from the store.

    The group functions (state check -> hasXXX/hasAnyXXX/containsXXX, state retrieval -> getXXX) supported by the retrieved ValuePageElementGroup are defined in Workflo.IValueElementNode.

    Type parameters

    Parameters

    • content: Content

      an object whose keys are the names of PageNodes managed by the ValuePageElementGroup and whose values are instances of these PageNodes

    Returns ValuePageElementGroup<this, Content>

    an instance of the retrieved PageElementGroup

Protected ValueList

  • Retrieves an instance of a ValuePageElementList from the store that manages any instance of ValuePageElement which inherits from the ValuePageElement class.

    The waitType of PageElements managed by ValuePageElementList and the waitType of the list itself are set to 'visible' by default.

    template

    PageElementType the type of ValuePageElement managed by ValuePageElementList

    template

    PageElementOpts the type of the opts parameter passed to the constructor function of ValuePageElements managed by ValuePageElementList

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved ValuePageElementList

    • opts: Pick<IValuePageElementListOpts<this, PageElementType, PageElementOpts, ReturnType<PageElementType["getValue"]>>, ListConstructorKeys>

      the publicly available options used to configure the retrieved ValuePageElementList

    Returns ValuePageElementList<this, PageElementType, PageElementOpts, ReturnType<PageElementType["getValue"]>>

    an instance of the retrieved ValuePageElementList

Protected ValueMap

  • Retrieves an instance of a ValuePageElementMap from the store that manages any instance of ValuePageElement which inherits from the ValuePageElement class.

    The waitType of ValuePageElements managed by ValuePageElementMap is set to 'visible' by default.

    template

    K the names of all ValuePageElements managed by ValuePageElementMap

    template

    PageElementType the type of ValuePageElement managed by ValuePageElementMap

    template

    PageElementOpts the type of the opts parameter passed to the constructor function of ValuePageElements managed by ValuePageElementMap

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved ValuePageElementMap

    • opts: Pick<IValuePageElementMapOpts<this, K, PageElementType, PageElementOpts, ReturnType<PageElementType["getValue"]>>, MapConstructorKeys>

      the publicly available options used to configure the retrieved ValuePageElementMap

    Returns ValuePageElementMap<this, K, PageElementType, PageElementOpts, ReturnType<PageElementType["getValue"]>>

    an instance of the retrieved ValuePageElementMap

Private _get

  • _get<Type, Opts>(selector: XPath, type: object, opts?: Opts, afterConstruction?: function): Type
  • Creates or retrieves a cached version of a PageNode instance with the given selector, type and opts.

    If a page element with identical parameters already exists in this store, a cached instance of this page element will be returned.

    template

    Type type of the retrieved PageElement instance

    template

    Opts type of the opts parameter passed to the constructor of the retrieved PageNode instance

    Type parameters

    • Type

    • Opts

    Parameters

    • selector: XPath

      the selector of the retrieved PageNode

    • type: object

      the constructor function of the retrieved PageNode instance

    • Default value opts: Opts = Object.create(Object.prototype)

      the opts parameter passed to the constructor of the retrieved PageNode instance

    • Optional afterConstruction: function
        • (instance: Type): void
        • Parameters

          • instance: Type

          Returns void

    Returns Type

Protected _getElement

  • _getElement<ElementType, ElementOptions>(selector: XPath, type: object, opts?: ElementOptions): ElementType
  • Creates or retrieves a cached version of a PageElement instance.

    template

    ElementType type of the retrieved PageElement instance

    template

    ElementOpts type of the opts parameter passed to the constructor of the retrieved PageElement instance

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElement instance

    • type: object

      the constructor function of the retrieved PageElement instance

    • Default value opts: ElementOptions = Object.create(Object.prototype)

      the opts parameter passed to the constructor of the retrieved PageElement instance

    Returns ElementType

Protected _getGroup

  • _getGroup<Store, Content, GroupType, GroupOptions>(type: object, opts: GroupOptions): GroupType
  • Creates or retrieves a cached version of a PageElementGroup instance.

    template

    Store type of the PageElementGroup's PageNodeStore

    template

    GroupType type of the retrieved PageElementGroup instance

    template

    GroupOptions type of the opts parameter passed to the constructor of the retrieved PageElementGroup instance

    Type parameters

    Parameters

    • type: object

      the constructor function of the retrieved PageElementGroup instance

    • opts: GroupOptions

      the opts parameter passed to the constructor of the retrieved PageElementGroup instance

    Returns GroupType

Protected _getList

  • _getList<ListType, ListOptions>(selector: XPath, type: object, opts?: ListOptions): ListType
  • Creates or retrieves a cached version of a PageElementList instance.

    template

    ListType type of the retrieved PageElementList instance

    template

    ListOptions type of the opts parameter passed to the constructor of the retrieved PageElementList instance

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElementList instance

    • type: object

      the constructor function of the retrieved PageElementList instance

    • Default value opts: ListOptions = Object.create(Object.prototype)

      the opts parameter passed to the constructor of the retrieved PageElementList instance

    Returns ListType

Protected _getMap

  • _getMap<K, MapType, MapOptions>(selector: XPath, type: object, opts?: MapOptions): MapType
  • Creates or retrieves a cached version of a PageElementMap instance.

    template

    MapType type of the retrieved PageElementMap instance

    template

    MapOptions type of the opts parameter passed to the constructor of the retrieved PageElementMap instance

    Type parameters

    Parameters

    • selector: XPath

      the XPath selector of the retrieved PageElementMap instance

    • type: object

      the constructor function of the retrieved PageElementMap instance

    • Default value opts: MapOptions = Object.create(Object.prototype)

      the opts parameter passed to the constructor of the retrieved PageElementMap instance

    Returns MapType

Generated using TypeDoc