Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Assertions

Bounding Box

Collections async

Collections search

Console

Date

Drag

Dropdown

Element Actions

Element Base

Element General

Element Properties

Element States

Element Waits

Errors

Frame General

Frame Search

Keyboard

Loggers

Network

Other

Page Actions

Scroll

Selectors

Waiters

Assertions

isEqualAsync

  • isEqualAsync<T>(actual: () => Promise<T>, expected: Promise<T> | T): Promise<any>
  • Function checks if promise-like return function value is equal another promise value or value

    Type parameters

    • T

    Parameters

    • actual: () => Promise<T>

      async function

        • (): Promise<T>
        • Returns Promise<T>

    • expected: Promise<T> | T

      async param or param

    Returns Promise<any>

Bounding Box

Const floorValues

  • floorValues<T>(boundingBox: T): any
  • Returns floored numeric properties in object

    Type parameters

    • T: {[ K in string | number | symbol]: number }

    Parameters

    • boundingBox: T

      Object that contain only numeric props

    Returns any

getBottom

  • getBottom(boundingBox: BoundingBox): number

getBoundingBox

  • getBoundingBox(element: ElementHandle): Promise<BoundingBox>

Const getCenter

  • getCenter(box: BoundingBox): Point

getElementVisibleBoundingBox

  • getElementVisibleBoundingBox(element: BoundingBox, viewport: BoundingBox): BoundingBox | null

getFrameBoundingBox

  • getFrameBoundingBox(page: Page, frame: Frame): Promise<BoundingBox>
  • Returns frame bounding box. Uses frame.name() as frame id first or frame.name() as name. Useful for case, when you have instance of frame, but you don't know it's selector. If frame does not exist - throws an exception.

    Parameters

    • page: Page
    • frame: Frame

    Returns Promise<BoundingBox>

Const getOffsetToCenter

  • getOffsetToCenter(box: BoundingBox): Offsets

Const getPointByDimensionDivider

  • getPointByDimensionDivider(box: BoundingBox, divider: number): { x: number; y: number }

getRight

  • getRight(boundingBox: BoundingBox): number

getSnugBoundingBox

  • Returns bounding box of two elements, where left top border is their coordinates minimum and right bottom border is their coordinates maximum. Is useful in cases like selection of several elements and checking which area is selected.

    Parameters

    Returns BoundingBox

getX

  • getX(element: ElementHandle): Promise<number>
  • Returns left border coordinates of bounding box

    Parameters

    • element: ElementHandle

    Returns Promise<number>

getY

  • getY(element: ElementHandle): Promise<number>
  • Returns top border coordinates of bounding box

    Parameters

    • element: ElementHandle

    Returns Promise<number>

isInCenterOfContainer

  • isInCenterOfContainer(container: BoundingBox, child: BoundingBox): boolean

isOffsetBy

  • isOffsetBy(boundingBoxSource: BoundingBox, boundingBoxTarget: BoundingBox, offsets: Partial<BoundingBox>): boolean
  • Checks that offsets from one bounding box to another is equal expected

    Parameters

    • boundingBoxSource: BoundingBox
    • boundingBoxTarget: BoundingBox
    • offsets: Partial<BoundingBox>

    Returns boolean

isPlacedInside

  • isPlacedInside(container: BoundingBox, insideElement: BoundingBox): boolean
  • Checks if one bounding box is placed inside another and not gone over the borders

    Parameters

    • container: BoundingBox
    • insideElement: BoundingBox

    Returns boolean

waitForBoundingToBePlacedInside

  • waitForBoundingToBePlacedInside(boundingGetter: () => Promise<BoundingBox>, parentBounding: BoundingBox, waitOptions?: WaitOptions): Promise<void>
  • Waits for bounding box to be placed inside another and not go beyond the borders.

    Parameters

    • boundingGetter: () => Promise<BoundingBox>

      Async function that returns bounding box that should be placed inside parent

        • (): Promise<BoundingBox>
        • Returns Promise<BoundingBox>

    • parentBounding: BoundingBox

      Parent bounding box

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

Collections async

createPromiseChain

  • createPromiseChain<T>(items: T[], action: (item: T) => Promise<void>): Promise<void>
  • Creates promise chain. Returns void.

    Type parameters

    • T

    Parameters

    • items: T[]
    • action: (item: T) => Promise<void>
        • (item: T): Promise<void>
        • Parameters

          • item: T

          Returns Promise<void>

    Returns Promise<void>

eachAsync

  • eachAsync<T>(collection: Promise<T>[], iteratee: (item: T) => Promise<any> | any): Promise<void>
  • Executes function for every promise in collection. Awaits for each Promise in array. Guarantees order. Useful when you have collection of Promises, and after they would be resolved after some action, order should be the same.

    Type parameters

    • T

    Parameters

    • collection: Promise<T>[]
    • iteratee: (item: T) => Promise<any> | any
        • (item: T): Promise<any> | any
        • Parameters

          • item: T

          Returns Promise<any> | any

    Returns Promise<void>

filterAsync

  • filterAsync<T>(elements: Promise<T>[] | T[], asyncFilter: (arg: T) => Promise<boolean>): Promise<T[]>
  • Filters async filter elements from collection. Guarantees order.

    Type parameters

    • T

    Parameters

    • elements: Promise<T>[] | T[]
    • asyncFilter: (arg: T) => Promise<boolean>
        • (arg: T): Promise<boolean>
        • Parameters

          • arg: T

          Returns Promise<boolean>

    Returns Promise<T[]>

findAsync

  • findAsync<T>(elements: Promise<T>[] | T[], asyncFilter: (arg: T) => Promise<boolean>): Promise<T | undefined>
  • Finds first element in collection by async filter.

    Type parameters

    • T

    Parameters

    • elements: Promise<T>[] | T[]
    • asyncFilter: (arg: T) => Promise<boolean>
        • (arg: T): Promise<boolean>
        • Parameters

          • arg: T

          Returns Promise<boolean>

    Returns Promise<T | undefined>

mapAsync

  • mapAsync<T, R>(elements: Promise<T>[] | T[], mapAction: (arg: T) => Promise<R>): Promise<R[]>
  • Maps collection by async mapper. Guarantees order.

    Type parameters

    • T

    • R

    Parameters

    • elements: Promise<T>[] | T[]
    • mapAction: (arg: T) => Promise<R>
        • (arg: T): Promise<R>
        • Parameters

          • arg: T

          Returns Promise<R>

    Returns Promise<R[]>

Collections search

getElementFromArrayByContainingText

getElementFromArrayByText

getElementIndexByContainingText

getElementIndexByProperty

getElementIndexByText

getElementsTextsFromArray

Console

getCopiedText

Drag

dragBy

  • dragBy(page: Page, from: Point, byX: number, byY: number, options?: DragOptions): Promise<void>
  • Drags element from point to point with offset by defined coordinates.

    Parameters

    • page: Page

      Page or Frame

    • from: Point

      Coordinates of the drag object

    • byX: number

      Left offset

    • byY: number

      Top offset

    • Optional options: DragOptions

      DragOptions

    Returns Promise<void>

dragElementBy

  • Drags element from it's center to point with offsets from center. Guarantees that element position would be stable (do not jump) after drag.

    Parameters

    • page: Page

      Page or Frame

    • element: SelectorOrElement

      Selector or element

    • byX: number

      Left offset

    • byY: number

      Top offset

    • Optional options: DragOptions

      DragOptions

    Returns Promise<void>

dragElementToElement

dragElementToPoint

  • Drag element to coordinates. Start drag point is element center. Guarantees that element position would be stable (do not jump) after drag.

    Parameters

    Returns Promise<void>

dragTo

  • Executes drag from point to point. Doesn't guarantee that drag entity location would be stable after drag.

    Parameters

    • page: Page

      Page or Frame

    • from: Point

      Point from where drag is executed

    • to: Point

      Target point

    • options: DragOptions = {}

      DragOptions

    Returns Promise<void>

moveToCoordinates

  • moveToCoordinates(page: Page, from: Point, to: Point, continuous?: boolean, steps?: number): Promise<void>
  • Drag from point to point. Generic function that drag utils are using. Strongly recommended not use it directly, but to use its wrappers. Drags element first by horizontally X, then vertically by Y.

    Parameters

    • page: Page

      Page or Frame

    • from: Point

      Point from which drag is executed

    • to: Point

      Target point

    • Optional continuous: boolean

      if enabled - drag will be executed pixel by pixel number of times which equal drag distance if steps are not defined. If steps are defined - dragDistance / steps. If not enabled - would be dragged in 1 step per axis.

    • Optional steps: number

      Amount of steps by which drag would be executed

    Returns Promise<void>

Dropdown

getDropdownOptionBySelector

  • getDropdownOptionBySelector(context: DocumentContext, dropdownOpenSelector: SelectorOrElement, dropdownOptionSelector: string): Promise<ElementHandle<Element>>

getDropdownOptionByTextExactMatch

  • getDropdownOptionByTextExactMatch(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, text: string): Promise<ElementHandle<Element>>

getDropdownOptionByValue

  • getDropdownOptionByValue(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, value: string): Promise<ElementHandle<Element>>
  • Opens dropdown and gets dropdown option by value element property.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement

      Open dropdown element or it's selector

    • dropdownOptionsSelector: string

      Dropdown Options selector

    • value: string

      Value of 'value' property

    Returns Promise<ElementHandle<Element>>

getDropdownOptions

getDropdownOptionsAttribute

isDropdownOptionAvailableByValue

  • isDropdownOptionAvailableByValue(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, value: string): Promise<boolean>
  • Opens dropdown and verifies that dropdown option with property value exists and not disabled.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement

      Open dropdown element or it's selector

    • dropdownOptionsSelector: string

      Dropdown Options selector

    • value: string

      Value of 'value' property

    Returns Promise<boolean>

isDropdownOptionExistByValue

  • isDropdownOptionExistByValue(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, value: string): Promise<boolean>
  • Opens dropdown and verifies that dropdown option with property value exists.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement

      Open dropdown element or it's selector

    • dropdownOptionsSelector: string

      Dropdown Options selector

    • value: string

      Value of 'value' property

    Returns Promise<boolean>

openDropdown

  • Opens dropdown and returns array of dropdown option elements.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement

      Open dropdown element or it's selector

    • dropdownOptionsSelector: string

      Dropdown Options selector

    Returns Promise<ElementHandle<Element>[]>

selectDropdownOptionByContainingText

  • selectDropdownOptionByContainingText(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement | null, dropdownOptionsSelector: string, text: string): Promise<void>
  • Opens dropdown (if needed) and select option by containing text.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement | null

      Open dropdown element or it's selector or null. If null - doesn't click on open dropdown element.

    • dropdownOptionsSelector: string

      Dropdown Options selector

    • text: string

      Target text

    Returns Promise<void>

selectDropdownOptionByContainingValue

  • selectDropdownOptionByContainingValue(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, value: string): Promise<void>

selectDropdownOptionByIndex

  • selectDropdownOptionByIndex(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, index: number): Promise<void>

selectDropdownOptionBySelector

  • selectDropdownOptionBySelector(context: DocumentContext, dropdownOpenSelector: SelectorOrElement, dropdownOptionSelector: string, waitTo?: "option-stop-moving" | "option-not-intersecting-viewport"): Promise<void>
  • Opens dropdown and selects dropdown option by selector. Waits optionally for option to not exist or to not to be in viewport.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelector: SelectorOrElement

      Open dropdown element, or it's selector.

    • dropdownOptionSelector: string

      Dropdown Options selector

    • waitTo: "option-stop-moving" | "option-not-intersecting-viewport" = 'option-not-intersecting-viewport'

      Default - wait for option not to be in viewport. Also can wait for option not to exist.

    Returns Promise<void>

selectDropdownOptionByTextExactMatch

  • selectDropdownOptionByTextExactMatch(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, text: string): Promise<void>

selectDropdownOptionByValue

  • selectDropdownOptionByValue(context: DocumentContext, dropdownOpenSelectorOrElement: SelectorOrElement, dropdownOptionsSelector: string, value: string): Promise<void>
  • Opens dropdown and select option by value exact match of property 'value'.

    Parameters

    • context: DocumentContext

      Page or Frame

    • dropdownOpenSelectorOrElement: SelectorOrElement

      Open dropdown element, or it's selector

    • dropdownOptionsSelector: string

      Dropdown Options selector

    • value: string

      Value of property 'value'

    Returns Promise<void>

Element Actions

blur

clearFocusedInput

  • clearFocusedInput(page: Page): Promise<void>

clearInput

  • Method clears the input. Before clearing the value method performs click on the element. After clicking on the input it clears the data inside by selecting all text and deleting it. If a selector was passed then the method tries to find the element and only then clears the value. In order to clear the input a page object is needed, so if the context is Frame then an additional page argument should be passed.

    Parameters

    Returns Promise<void>

click

  • Click on the provided element. If a selector was passed then the method tries to find the element and only then click on it. The click is available only if the button is not disabled, otherwise the error is thrown.

    Parameters

    Returns Promise<void>

clickAtOffset

clickOnParent

evaluateOnSelectorOrElement

  • Evaluates browser function on element in defined browser context.

    example

    const outerText = await evaluateOnSelectorOrElement((e) => e.outerText, page, element);

    Type parameters

    • T: EvaluateFn<any, any, any>

    Parameters

    Returns Promise<EvaluateFnReturnType<T> extends PromiseLike<infer U> ? U : EvaluateFnReturnType<T>>

filterElementsByContainAttribute

filterElementsByExactAttribute

filterVisibleElements

getElementsCollectionLength

getParent

hover

hoverAtOffset

  • This method performs hover by offsets from element.

    Parameters

    • page: Page

      Page or Frame

    • element: SelectorOrElement

      Element or selector

    • Optional offsets: Offsets

      Offset coordinates

    • Optional options: { steps: number }

      Number of mouse moves during hover

      • steps: number

    Returns Promise<void>

scrollIntoView

type

  • Types a text to the provided element. Before typing the value in the input field it's cleared if not specified otherwise. In order to clear the input a page object is needed, so if the context is Frame then an additional page argument should be passed.

    Parameters

    Returns Promise<void>

Element General

getElement

getElements

Element Properties

getAttribute

getClasses

getComputedStyle

getElementBackgroundColor

getElementStyle

getElementStyleAsRGB

getHtml

getProperty

getSrc

getText

getValue

Const hexAsRgb

  • hexAsRgb(hex: null | string): null | { b: number; g: number; r: number }
  • Returns hex color value in {r,g,b} format.

    Parameters

    • hex: null | string

    Returns null | { b: number; g: number; r: number }

propertyAsOpacity

  • propertyAsOpacity(styleProperty: string): undefined | number
  • Returns style property as opacity. Only for transparent / {r,g,b,a} values. If property can't be parsed, returns empty string.

    Parameters

    • styleProperty: string

      string

    Returns undefined | number

propertyAsRGB

  • propertyAsRGB(styleProperty: string): undefined | { b: number; g: number; r: number }
  • Returns style property in {r,g,b} format. If transparent - returns {r:0, g:0, b:0}. If property can't be parsed, returns empty string (be careful, pass only color props inside).

    Parameters

    • styleProperty: string

      string

    Returns undefined | { b: number; g: number; r: number }

Element States

hasClass

  • hasClass(element: ElementHandle, className: string): Promise<boolean>
  • Checks if element contains class.

    Parameters

    • element: ElementHandle

      Element or selector

    • className: string

      Class name

    Returns Promise<boolean>

hasHeight

hasProperty

hasTruthyProperty

isBold

isChecked

isCollapsed

  • isCollapsed(element: ElementHandle): Promise<boolean>
  • Checks if element has class 'closed'. Can be project specific (will not work if closed class is not assigned to element on collapse).

    Parameters

    • element: ElementHandle

    Returns Promise<boolean>

isDisabled

isExpanded

  • isExpanded(element: ElementHandle): Promise<boolean>
  • Checks if element has class 'open'. Can be project specific (will not work if open class is not assigned to element on expand).

    Parameters

    • element: ElementHandle

    Returns Promise<boolean>

isFullyInViewport

  • isFullyInViewport(context: DocumentContext, selector: string, index?: number, offsets?: Offsets): Promise<boolean>
  • Checks if element is fully in viewport. Helps when element.isIntersectingViewport() doesn't return correct value (example - for animations). Supports getting element from array by index and offsets from borders of viewport.

    Parameters

    • context: DocumentContext

      Page or Frame

    • selector: string

      Selector

    • index: number = 0

      Element index (default - 0)

    • offsets: Offsets = ...

      Offsets from bottom and right border of viewport

    Returns Promise<boolean>

isItalic

isRequired

isSelected

  • isSelected(element: ElementHandle): Promise<boolean>
  • Checks if element has class 'selected'. Can be project specific (will not work if selected class is not assigned to element on selection).

    Parameters

    • element: ElementHandle

    Returns Promise<boolean>

isUnderline

isVisible

  • Verifies if the element visible by checking next conditions:

    • if the element is absent in DOM then returns false at once
    • if the element computed style property opacity === '0' then returns false
    • if the element computed style property display === 'none' then returns false
    • if the element computed style property visibility === 'hidden' then returns false
    • if the element bounding box value equals to null then returns false
    • in other cases it returns true

    Parameters

    Returns Promise<boolean>

Element Waits

waitForAttributeToBeChanged

  • Waits for attribute value of element to be changed after async action. If it doesn't changed after timeout - throws an exception.

    example

    await waitForAttributeToBeChanged(page, element, 'value', () => driver.type(40));

    Parameters

    • context: DocumentContext

      Page or Frame

    • element: SelectorOrElement

      Element or selector

    • attribute: AttributeType

      Attribute name

    • action: () => Promise<any>

      Async function after which attribute should be changed

        • (): Promise<any>
        • Returns Promise<any>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForElement

waitForElementAttributeToStopChanging

waitForElementNotToBeInViewport

  • Waits for element not to be in viewport. Using method isIntersectingViewport() that can sometimes return incorrect value (example - in cases of animation when element is disappears but isIntersectingViewport() returns true)

    example

    await waitForElementNotToBeInViewport(page, [data-hook='side-panel']);

    Parameters

    Returns Promise<void>

waitForElementNotToHaveAttribute

waitForElementPositionToBeStale

waitForElementToBeChecked

waitForElementToBeExpanded

  • waitForElementToBeExpanded(element: ElementHandle, waitOptions?: WaitOptions): Promise<void>
  • Waits for element to have class 'open'. If expanding element is not assigning this class, this method wouldn't work.

    example

    await element.click();
    await waitForElementToBeExpanded(element);

    Parameters

    • element: ElementHandle

      Selector or element

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForElementToBeInViewport

waitForElementToBeNotDisabled

  • Waits for element to have property 'disabled' or 'disabled' class. If element is not assign class / property 'disabled' after disabling, this method wouldn't work.

    example

    await panel.open();
    await waitForElementToBeNotDisabled(page, panelElement);

    Parameters

    Returns Promise<void>

waitForElementToBeUnChecked

waitForElementToContainClass

waitForElementToContainText

waitForElementToHaveAttribute

waitForElementToHaveAttributePart

waitForElementToHaveProperty

waitForElementToHavePropertyPart

waitForElementToHaveText

waitForScopedSelector

  • Waits for internal element that is rendered inside initialized ElementHandle instance. Supports xpath selectors. If element doesn't found - throws exception. Historically was created for first versions of Puppeteer which didn't have element.waitForSelector(selector);

    example

    const rootElement = await getElement(context, '#root');
    const internalElement = await waitForScopedSelector(page, rootElement, '#element_1');

    Parameters

    Returns Promise<any>

waitToBeNotVisible

waitToBeVisible

Errors

throwTestError

  • throwTestError(message: string, call: (...args: any) => Promise<any> | any): void
  • Throws error method for async function waiters. Shows which actual highest level function call failed.

    Parameters

    • message: string
    • call: (...args: any) => Promise<any> | any
        • (...args: any): Promise<any> | any
        • Parameters

          • Rest ...args: any

          Returns Promise<any> | any

    Returns void

Frame General

isFrame

isPage

waitForFrameToBeDetached

  • waitForFrameToBeDetached(frame: Frame, waitOptions?: WaitOptions): Promise<void>

Frame Search

getFrameByName

getFrameBySelector

getFrameByTitle

getFrameByUrl

Loggers

Const log

  • log(target: any, propertyKey: string, descriptor: PropertyDescriptor): undefined | PropertyDescriptor
  • Logs class method. Usage: put @log decorator above your class method. Output would be in logs: '{timestamp} Calling ClassName.method(...args);'

    example

    @log
    async clickOnElement() {
    return this.clickOnInternalElement(selectors.element);
    }

    Parameters

    • target: any
    • propertyKey: string
    • descriptor: PropertyDescriptor

    Returns undefined | PropertyDescriptor

makeLoggable

  • makeLoggable<T>(obj: T): T
  • Make complicated object to be simple and readable in logs. Assigns property __DISPLAY_NAME: objectKey for each internal object

    example

    makeLoggable({
    property1: {
    property2: {
    property3: {
    prop4: 'str',
    },
    },
    },
    })
    would return
    {
    property1: {
    property2: {
    property3: {
    prop4: 'str',
    __DISPLAY_NAME: 'property3',
    },
    __DISPLAY_NAME: 'property2',
    },
    __DISPLAY_NAME: 'property1',
    },
    }')

    Type parameters

    • T: Record<string, unknown>

    Parameters

    • obj: T

    Returns T

Other

ActionReturnType

ActionReturnType: Promise<boolean | null | undefined> | boolean | null | undefined

AtLeastTwoValuesArray

AtLeastTwoValuesArray<T>: [T, T, ...T[]]

Type parameters

  • T

AttributeMatcher

AttributeMatcher: typeof AttributeMatcher[keyof typeof AttributeMatcher]

AttributeType

AttributeType: typeof AttributeType[keyof typeof AttributeType] | string

DateFormat

DateFormat: typeof DateFormats[keyof typeof DateFormats]

DocumentContext

DocumentContext: Page | Frame

ElementOptions

ElementOptions: Omit<WaitForSelectorOptions, "root">

ElementPropertyType

ElementPropertyType: typeof ElementPropertyType[keyof typeof ElementPropertyType] | string

KeyboardKeysType

KeyboardKeysType: string | MetaKeysType

MetaKeysType

MetaKeysType: typeof MetaKeys[keyof typeof MetaKeys]

SelectorOrElement

SelectorOrElement: ElementHandle | string

SelectorOrElements

SelectorOrElements: ElementHandle[] | string

StringOrRegExp

StringOrRegExp: string | RegExp

StyleProperty

StyleProperty: typeof StyleProperty[keyof typeof StyleProperty] | string

Const AttributeMatcher

AttributeMatcher: { CONTAINS: "*="; ENDS_WITH: "$="; EQUALS: "="; STARTS_WITH: "^=" } = ...

Type declaration

  • CONTAINS: "*="
  • ENDS_WITH: "$="
  • EQUALS: "="
  • STARTS_WITH: "^="

Const AttributeType

AttributeType: { ALT: "alt"; ARIA_CHECKED: "aria-checked"; ARIA_HIDDEN: "aria-hidden"; CLASS: "class"; DATA_AID: "data-aid"; DATA_AUTOMATION_ID: "data-automation-id"; DATA_CLASS: "data-class"; DATA_COMP: "data-comp"; DATA_COMP_ID: "data-comp-id"; DATA_DISABLED: "data-disabled"; DATA_HOOK: "data-hook"; DATA_ID: "data-id"; DATA_IS_HIDDEN: "data-is-hidden"; DATA_ITEM_ID: "data-item-id"; DATA_LAYER_LEVEL: "data-layer-level"; DATA_OPTION: "data-option"; DATA_PLAYER_NAME: "data-player-name"; DATA_PRESET_ID: "data-preset-id"; DATA_PRESET_INDEX: "data-preset-index"; DATA_REACTID: "data-reactid"; DATA_SELECTED: "data-selected"; DATA_SKINPART: "data-skinpart"; DATA_SRC: "data-src"; DATA_SRCSET: "data-srcset"; DATA_STATE: "data-state"; DATA_SVG_ID: "data-svg-id"; DATA_SVG_TYPE: "data-svg-type"; DATA_TEST_ID: "data-testid"; DATA_TOGGLE_STATE: "data-toggle-state"; DATA_TYPE: "data-type"; DATA_VIDEO_INFO: "data-video-info"; HREF: "href"; ID: "id"; NAME: "name"; ROLE: "role"; SRC: "src"; SRCSET: "srcset"; STYLE: "style"; TAB: "tab"; VALUE: "value" } = ...

Type declaration

  • ALT: "alt"
  • ARIA_CHECKED: "aria-checked"
  • ARIA_HIDDEN: "aria-hidden"
  • CLASS: "class"
  • DATA_AID: "data-aid"
  • DATA_AUTOMATION_ID: "data-automation-id"
  • DATA_CLASS: "data-class"
  • DATA_COMP: "data-comp"
  • DATA_COMP_ID: "data-comp-id"
  • DATA_DISABLED: "data-disabled"
  • DATA_HOOK: "data-hook"
  • DATA_ID: "data-id"
  • DATA_IS_HIDDEN: "data-is-hidden"
  • DATA_ITEM_ID: "data-item-id"
  • DATA_LAYER_LEVEL: "data-layer-level"
  • DATA_OPTION: "data-option"
  • DATA_PLAYER_NAME: "data-player-name"
  • DATA_PRESET_ID: "data-preset-id"
  • DATA_PRESET_INDEX: "data-preset-index"
  • DATA_REACTID: "data-reactid"
  • DATA_SELECTED: "data-selected"
  • DATA_SKINPART: "data-skinpart"
  • DATA_SRC: "data-src"
  • DATA_SRCSET: "data-srcset"
  • DATA_STATE: "data-state"
  • DATA_SVG_ID: "data-svg-id"
  • DATA_SVG_TYPE: "data-svg-type"
  • DATA_TEST_ID: "data-testid"
  • DATA_TOGGLE_STATE: "data-toggle-state"
  • DATA_TYPE: "data-type"
  • DATA_VIDEO_INFO: "data-video-info"
  • HREF: "href"
  • ID: "id"
  • NAME: "name"
  • ROLE: "role"
  • SRC: "src"
  • SRCSET: "srcset"
  • STYLE: "style"
  • TAB: "tab"
  • VALUE: "value"

Const DISPLAY_NAME

DISPLAY_NAME: "__DISPLAY_NAME" = '__DISPLAY_NAME'

Const DateFormats

DateFormats: { DD_MM_YYYY: "DD/MM/YYYY"; MM_DD_YYYY: "MM/DD/YYYY"; YYYY_MM_DD: "YYYY/MM/DD"; YYYY_M_D: "YYYY/M/D" } = ...

Type declaration

  • DD_MM_YYYY: "DD/MM/YYYY"
  • MM_DD_YYYY: "MM/DD/YYYY"
  • YYYY_MM_DD: "YYYY/MM/DD"
  • YYYY_M_D: "YYYY/M/D"

Const DefaultAttemptWaitOptions

DefaultAttemptWaitOptions: { assertCondition: undefined; attempts: number; interval: number } = ...

Type declaration

  • assertCondition: undefined
  • attempts: number
  • interval: number

Const DefaultRequestTypes

DefaultRequestTypes: string[] = ...

Const DefaultWaitOptions

DefaultWaitOptions: { pollIntervalMs: number; timeoutMs: number } = ...

Type declaration

  • pollIntervalMs: number
  • timeoutMs: number

Const ElementPropertyType

ElementPropertyType: { checked: "checked"; class: "class"; disabled: "disabled"; id: "id"; innerText: "innerText"; required: "required"; src: "src"; value: "value" } = ...

Type declaration

  • checked: "checked"
  • class: "class"
  • disabled: "disabled"
  • id: "id"
  • innerText: "innerText"
  • required: "required"
  • src: "src"
  • value: "value"

Const MetaKeys

MetaKeys: { Alt: 1; ControlOrCommand: 0 } = ...

Type declaration

  • Alt: 1
  • ControlOrCommand: 0

Const SpecialKeys

SpecialKeys: { ArrowDown: "ArrowDown"; ArrowLeft: "ArrowLeft"; ArrowRight: "ArrowRight"; ArrowUp: "ArrowUp"; Backspace: "Backspace"; Delete: "Delete"; Enter: "Enter"; Escape: "Escape"; Minus: "Minus"; Plus: "107"; Shift: "Shift" } = ...

Type declaration

  • ArrowDown: "ArrowDown"
  • ArrowLeft: "ArrowLeft"
  • ArrowRight: "ArrowRight"
  • ArrowUp: "ArrowUp"
  • Backspace: "Backspace"
  • Delete: "Delete"
  • Enter: "Enter"
  • Escape: "Escape"
  • Minus: "Minus"
  • Plus: "107"
  • Shift: "Shift"

Const StyleProperty

StyleProperty: { ALIGN_SELF: "align-self"; BACKGROUND_COLOR: "background-color"; BACKGROUND_IMAGE: "background-image"; BORDER_BOTTOM_WIDTH: "border-bottom-width"; BORDER_LEFT_WIDTH: "border-left-width"; BORDER_RIGHT_WIDTH: "border-right-width"; BORDER_TOP_WIDTH: "border-top-width"; BORDER_WIDTH: "border-width"; COLOR: "color"; CSS_TEXT: "cssText"; DISPLAY: "display"; FILL: "fill"; FONT_FAMILY: "font-family"; FONT_SIZE: "font-size"; FONT_STYLE: "font-style"; FONT_WEIGHT: "font-weight"; GRID_AREA: "grid-area"; GRID_COLUMN_END: "grid-column-end"; GRID_COLUMN_START: "grid-column-start"; GRID_ROW_END: "grid-row-end"; GRID_ROW_START: "grid-row-start"; HEIGHT: "height"; JUSTIFY_CONTENT: "justifyContent"; JUSTIFY_SELF: "justify-self"; MARGIN_BOTTOM: "margin-bottom"; MARGIN_TOP: "margin-top"; OPACITY: "opacity"; ORDER: "order"; PADDING_BOTTOM: "padding-bottom"; PADDING_LEFT: "padding-left"; PADDING_RIGHT: "padding-right"; PADDING_TOP: "padding-top"; TEXT_ALIGN: "text-align"; TEXT_DECORATION: "text-decoration"; VISIBILITY: "visibility" } = ...

Type declaration

  • ALIGN_SELF: "align-self"
  • BACKGROUND_COLOR: "background-color"
  • BACKGROUND_IMAGE: "background-image"
  • BORDER_BOTTOM_WIDTH: "border-bottom-width"
  • BORDER_LEFT_WIDTH: "border-left-width"
  • BORDER_RIGHT_WIDTH: "border-right-width"
  • BORDER_TOP_WIDTH: "border-top-width"
  • BORDER_WIDTH: "border-width"
  • COLOR: "color"
  • CSS_TEXT: "cssText"
  • DISPLAY: "display"
  • FILL: "fill"
  • FONT_FAMILY: "font-family"
  • FONT_SIZE: "font-size"
  • FONT_STYLE: "font-style"
  • FONT_WEIGHT: "font-weight"
  • GRID_AREA: "grid-area"
  • GRID_COLUMN_END: "grid-column-end"
  • GRID_COLUMN_START: "grid-column-start"
  • GRID_ROW_END: "grid-row-end"
  • GRID_ROW_START: "grid-row-start"
  • HEIGHT: "height"
  • JUSTIFY_CONTENT: "justifyContent"
  • JUSTIFY_SELF: "justify-self"
  • MARGIN_BOTTOM: "margin-bottom"
  • MARGIN_TOP: "margin-top"
  • OPACITY: "opacity"
  • ORDER: "order"
  • PADDING_BOTTOM: "padding-bottom"
  • PADDING_LEFT: "padding-left"
  • PADDING_RIGHT: "padding-right"
  • PADDING_TOP: "padding-top"
  • TEXT_ALIGN: "text-align"
  • TEXT_DECORATION: "text-decoration"
  • VISIBILITY: "visibility"

Const TestError

TestError: { AttributeWasNotChanged: (attribute: string, action: () => Promise<any>, timeout: number) => string; Base: (message: string, call: (...args: any) => any) => string; BoundingBox: () => string; BoundingIsNotPlacedInside: (boundingGetter: () => Promise<any>, parentBounding: any) => Promise<string>; CollectionIsEmpty: (timeout: number) => string; CollectionIsNotEmpty: (timeout: number) => string; CollectionLengthToBe: (expectedLength: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>; CollectionLengthToBeMoreThan: (moreThan: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>; CollectionLengthToBeNotLessThan: (minLength: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>; CollectionNotToHaveItem: <T>(func: () => Promise<T[]>, value: T, timeout: number) => Promise<string>; CollectionToHaveItem: <T>(func: () => Promise<T[]>, value: T, timeout: number) => Promise<string>; ContainedTextIsNotFoundInArray: (text: string) => string; ElementDoesNotHaveAttribute: (attribute: string, value: string, timeout: number) => string; ElementDoesNotHaveAttributePart: (attribute: string, valuePart: string, timeout: number) => string; ElementDoesNotHavePropertyPart: (property: string, valuePart: string, timeout: number) => string; ElementIsDisabledOnClick: (selectorOrElement: SelectorOrElement) => string; ElementIsLeftChecked: (timeout: number) => string; ElementIsLeftDisabled: (timeout: number) => string; ElementIsNotChecked: (timeout: number) => string; ElementIsNotContainText: (text: string, timeout: number) => string; ElementIsNotExpanded: (timeout: number) => string; ElementIsNotInViewport: (timeout: number) => string; ElementIsStillInViewport: (timeout: number) => string; ElementStillHasAttribute: (attribute: string, value: string, timeout: number) => string; ElementWithSelectorWasNotFound: (selector: string) => string; ExactTextIsNotFoundInArray: (text: string) => string; FailedToInitializePage: (partialUrlOrUrlPattern: string | RegExp) => string; FormatIsNotImplemented: (formatType: string) => string; FrameWasNotDetached: (url: string, timeout: number) => string; FrameWithNameWasNotFound: (name: string, timeout: number) => string; FrameWithUrlWasNotFound: (frameUrl: string, timeout: number) => string; FunctionValueToBeChanged: <T>(funcValue: T, action: () => Promise<any>, timeout: number) => Promise<string>; IsFalsy: (timeout: number) => string; LocalStorageIsDisabled: () => string; ObjectsNotToBeEqual: <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number) => Promise<string>; ObjectsToBeEqual: <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number) => Promise<string>; OptionIsNotFound: (option: LayoutDimension) => string; PageArgumentIsNotPassed: () => string; RegExpWithStrictMatch: () => string; StringFunctionToContainString: (func: () => Promise<string>, value: string, timeout: number) => Promise<string>; TabIsNotFound: (partialUrlOrUrlPattern: string | RegExp) => string; ValueIsEqualOrLessThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>; ValueIsEqualOrMoreThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>; ValueIsLessThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>; ValueIsMoreThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>; ValueToStopChanging: <T>(existingValue: T, newValue: T, timeout: number) => string; ValuesToBeCloseTo: (actual: number, expected: number, difference: number, delta: number, timeout: number) => string; WaitFor: (timeoutMs: number) => string; WithAttempts: (attempts: number, interval: number) => string } = ...

Type declaration

  • AttributeWasNotChanged: (attribute: string, action: () => Promise<any>, timeout: number) => string
      • (attribute: string, action: () => Promise<any>, timeout: number): string
      • Parameters

        • attribute: string
        • action: () => Promise<any>
            • (): Promise<any>
            • Returns Promise<any>

        • timeout: number

        Returns string

  • Base: (message: string, call: (...args: any) => any) => string
      • (message: string, call: (...args: any) => any): string
      • Parameters

        • message: string
        • call: (...args: any) => any
            • (...args: any): any
            • Parameters

              • Rest ...args: any

              Returns any

        Returns string

  • BoundingBox: () => string
      • (): string
      • Returns string

  • BoundingIsNotPlacedInside: (boundingGetter: () => Promise<any>, parentBounding: any) => Promise<string>
      • (boundingGetter: () => Promise<any>, parentBounding: any): Promise<string>
      • Parameters

        • boundingGetter: () => Promise<any>
            • (): Promise<any>
            • Returns Promise<any>

        • parentBounding: any

        Returns Promise<string>

  • CollectionIsEmpty: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • CollectionIsNotEmpty: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • CollectionLengthToBe: (expectedLength: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>
      • (expectedLength: number, collection: () => Promise<any[]>, timeout: number): Promise<string>
      • Parameters

        • expectedLength: number
        • collection: () => Promise<any[]>
            • (): Promise<any[]>
            • Returns Promise<any[]>

        • timeout: number

        Returns Promise<string>

  • CollectionLengthToBeMoreThan: (moreThan: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>
      • (moreThan: number, collection: () => Promise<any[]>, timeout: number): Promise<string>
      • Parameters

        • moreThan: number
        • collection: () => Promise<any[]>
            • (): Promise<any[]>
            • Returns Promise<any[]>

        • timeout: number

        Returns Promise<string>

  • CollectionLengthToBeNotLessThan: (minLength: number, collection: () => Promise<any[]>, timeout: number) => Promise<string>
      • (minLength: number, collection: () => Promise<any[]>, timeout: number): Promise<string>
      • Parameters

        • minLength: number
        • collection: () => Promise<any[]>
            • (): Promise<any[]>
            • Returns Promise<any[]>

        • timeout: number

        Returns Promise<string>

  • CollectionNotToHaveItem: <T>(func: () => Promise<T[]>, value: T, timeout: number) => Promise<string>
      • <T>(func: () => Promise<T[]>, value: T, timeout: number): Promise<string>
      • Type parameters

        • T

        Parameters

        • func: () => Promise<T[]>
            • (): Promise<T[]>
            • Returns Promise<T[]>

        • value: T
        • timeout: number

        Returns Promise<string>

  • CollectionToHaveItem: <T>(func: () => Promise<T[]>, value: T, timeout: number) => Promise<string>
      • <T>(func: () => Promise<T[]>, value: T, timeout: number): Promise<string>
      • Type parameters

        • T

        Parameters

        • func: () => Promise<T[]>
            • (): Promise<T[]>
            • Returns Promise<T[]>

        • value: T
        • timeout: number

        Returns Promise<string>

  • ContainedTextIsNotFoundInArray: (text: string) => string
      • (text: string): string
      • Parameters

        • text: string

        Returns string

  • ElementDoesNotHaveAttribute: (attribute: string, value: string, timeout: number) => string
      • (attribute: string, value: string, timeout: number): string
      • Parameters

        • attribute: string
        • value: string
        • timeout: number

        Returns string

  • ElementDoesNotHaveAttributePart: (attribute: string, valuePart: string, timeout: number) => string
      • (attribute: string, valuePart: string, timeout: number): string
      • Parameters

        • attribute: string
        • valuePart: string
        • timeout: number

        Returns string

  • ElementDoesNotHavePropertyPart: (property: string, valuePart: string, timeout: number) => string
      • (property: string, valuePart: string, timeout: number): string
      • Parameters

        • property: string
        • valuePart: string
        • timeout: number

        Returns string

  • ElementIsDisabledOnClick: (selectorOrElement: SelectorOrElement) => string
  • ElementIsLeftChecked: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementIsLeftDisabled: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementIsNotChecked: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementIsNotContainText: (text: string, timeout: number) => string
      • (text: string, timeout: number): string
      • Parameters

        • text: string
        • timeout: number

        Returns string

  • ElementIsNotExpanded: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementIsNotInViewport: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementIsStillInViewport: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • ElementStillHasAttribute: (attribute: string, value: string, timeout: number) => string
      • (attribute: string, value: string, timeout: number): string
      • Parameters

        • attribute: string
        • value: string
        • timeout: number

        Returns string

  • ElementWithSelectorWasNotFound: (selector: string) => string
      • (selector: string): string
      • Parameters

        • selector: string

        Returns string

  • ExactTextIsNotFoundInArray: (text: string) => string
      • (text: string): string
      • Parameters

        • text: string

        Returns string

  • FailedToInitializePage: (partialUrlOrUrlPattern: string | RegExp) => string
      • (partialUrlOrUrlPattern: string | RegExp): string
      • Parameters

        • partialUrlOrUrlPattern: string | RegExp

        Returns string

  • FormatIsNotImplemented: (formatType: string) => string
      • (formatType: string): string
      • Parameters

        • formatType: string

        Returns string

  • FrameWasNotDetached: (url: string, timeout: number) => string
      • (url: string, timeout: number): string
      • Parameters

        • url: string
        • timeout: number

        Returns string

  • FrameWithNameWasNotFound: (name: string, timeout: number) => string
      • (name: string, timeout: number): string
      • Parameters

        • name: string
        • timeout: number

        Returns string

  • FrameWithUrlWasNotFound: (frameUrl: string, timeout: number) => string
      • (frameUrl: string, timeout: number): string
      • Parameters

        • frameUrl: string
        • timeout: number

        Returns string

  • FunctionValueToBeChanged: <T>(funcValue: T, action: () => Promise<any>, timeout: number) => Promise<string>
      • <T>(funcValue: T, action: () => Promise<any>, timeout: number): Promise<string>
      • Type parameters

        • T

        Parameters

        • funcValue: T
        • action: () => Promise<any>
            • (): Promise<any>
            • Returns Promise<any>

        • timeout: number

        Returns Promise<string>

  • IsFalsy: (timeout: number) => string
      • (timeout: number): string
      • Parameters

        • timeout: number

        Returns string

  • LocalStorageIsDisabled: () => string
      • (): string
      • Returns string

  • ObjectsNotToBeEqual: <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number) => Promise<string>
      • <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number): Promise<string>
      • Type parameters

        • T

        Parameters

        • actual: () => Promise<T>
            • (): Promise<T>
            • Returns Promise<T>

        • expected: T | Promise<T>
        • timeout: number

        Returns Promise<string>

  • ObjectsToBeEqual: <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number) => Promise<string>
      • <T>(actual: () => Promise<T>, expected: T | Promise<T>, timeout: number): Promise<string>
      • Type parameters

        • T

        Parameters

        • actual: () => Promise<T>
            • (): Promise<T>
            • Returns Promise<T>

        • expected: T | Promise<T>
        • timeout: number

        Returns Promise<string>

  • OptionIsNotFound: (option: LayoutDimension) => string
  • PageArgumentIsNotPassed: () => string
      • (): string
      • Returns string

  • RegExpWithStrictMatch: () => string
      • (): string
      • Returns string

  • StringFunctionToContainString: (func: () => Promise<string>, value: string, timeout: number) => Promise<string>
      • (func: () => Promise<string>, value: string, timeout: number): Promise<string>
      • Parameters

        • func: () => Promise<string>
            • (): Promise<string>
            • Returns Promise<string>

        • value: string
        • timeout: number

        Returns Promise<string>

  • TabIsNotFound: (partialUrlOrUrlPattern: string | RegExp) => string
      • (partialUrlOrUrlPattern: string | RegExp): string
      • Parameters

        • partialUrlOrUrlPattern: string | RegExp

        Returns string

  • ValueIsEqualOrLessThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>
      • (func: () => Promise<number>, value: number, timeout: number): Promise<string>
      • Parameters

        • func: () => Promise<number>
            • (): Promise<number>
            • Returns Promise<number>

        • value: number
        • timeout: number

        Returns Promise<string>

  • ValueIsEqualOrMoreThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>
      • (func: () => Promise<number>, value: number, timeout: number): Promise<string>
      • Parameters

        • func: () => Promise<number>
            • (): Promise<number>
            • Returns Promise<number>

        • value: number
        • timeout: number

        Returns Promise<string>

  • ValueIsLessThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>
      • (func: () => Promise<number>, value: number, timeout: number): Promise<string>
      • Parameters

        • func: () => Promise<number>
            • (): Promise<number>
            • Returns Promise<number>

        • value: number
        • timeout: number

        Returns Promise<string>

  • ValueIsMoreThan: (func: () => Promise<number>, value: number, timeout: number) => Promise<string>
      • (func: () => Promise<number>, value: number, timeout: number): Promise<string>
      • Parameters

        • func: () => Promise<number>
            • (): Promise<number>
            • Returns Promise<number>

        • value: number
        • timeout: number

        Returns Promise<string>

  • ValueToStopChanging: <T>(existingValue: T, newValue: T, timeout: number) => string
      • <T>(existingValue: T, newValue: T, timeout: number): string
      • Type parameters

        • T

        Parameters

        • existingValue: T
        • newValue: T
        • timeout: number

        Returns string

  • ValuesToBeCloseTo: (actual: number, expected: number, difference: number, delta: number, timeout: number) => string
      • (actual: number, expected: number, difference: number, delta: number, timeout: number): string
      • Parameters

        • actual: number
        • expected: number
        • difference: number
        • delta: number
        • timeout: number

        Returns string

  • WaitFor: (timeoutMs: number) => string
      • (timeoutMs: number): string
      • Parameters

        • timeoutMs: number

        Returns string

  • WithAttempts: (attempts: number, interval: number) => string
      • (attempts: number, interval: number): string
      • Parameters

        • attempts: number
        • interval: number

        Returns string

Let logger

logger: Logger

Page Actions

waitForTab

  • waitForTab(browser: Browser, partialUrlOrUrlPattern: StringOrRegExp, options?: WaitForTargetOptions): Promise<Page>
  • Method waits for tab with url part or url is opened and brings it to front. If tab does not exist - throws an exception.

    Parameters

    • browser: Browser
    • partialUrlOrUrlPattern: StringOrRegExp
    • Optional options: WaitForTargetOptions

    Returns Promise<Page>

Scroll

getScroll

scrollTo

scrollToBottom

  • scrollToBottom(context: DocumentContext, continuous?: boolean): Promise<void>

scrollToTop

scrollUp

waitForScrollToBeFinished

Selectors

Const chainSelectors

  • chainSelectors(first: string): (second: string) => string
  • Chain 2 selectors

    Parameters

    • first: string

    Returns (second: string) => string

      • (second: string): string
      • Parameters

        • second: string

        Returns string

getClassSelector

  • Returns class selector string. Supports =, *=, ^=, $= matchers.

    example

    getClassSelector('open', AttributeMatcher.CONTAINS) returns [class*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataAidSelector

  • Returns data-aid selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataAidSelector('open', AttributeMatcher.CONTAINS) returns [data-aid*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataAutomationIdSelector

  • getDataAutomationIdSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-automation-id selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataAutomationIdSelector('open', AttributeMatcher.CONTAINS) returns [data-automation-id*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataClassSelector

  • getDataClassSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-class selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataClassSelector('open', AttributeMatcher.CONTAINS) returns [data-class*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataCompIdSelector

  • getDataCompIdSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-comp-id selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataCompIdSelector('open', AttributeMatcher.CONTAINS) returns [data-comp-id*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataCompSelector

  • Returns data-comp selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataCompSelector('open', AttributeMatcher.CONTAINS) returns [data-comp*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataHookSelector

  • Returns data-hook selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataHookSelector('open', AttributeMatcher.CONTAINS) returns [data-hook*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataIdSelector

  • Returns data-aid selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataIdSelector('open', AttributeMatcher.CONTAINS) returns [data-aid*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataItemIdSelector

  • getDataItemIdSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-item-id selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataItemIdSelector('open', AttributeMatcher.CONTAINS) returns [data-item-id*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataOptionSelector

  • getDataOptionSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-option selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataOptionSelector('open', AttributeMatcher.CONTAINS) returns [data-option*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataReactIdSelector

  • getDataReactIdSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-reactid selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataReactIdSelector('open', AttributeMatcher.CONTAINS) returns [data-reactid*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataStateSelector

  • getDataStateSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-state selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataStateSelector('open', AttributeMatcher.CONTAINS) returns [data-state*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getDataTestidSelector

  • getDataTestidSelector(key: string, attributeMatcher?: AttributeMatcher): string
  • Returns data-testid selector string. Supports =, *=, ^=, $= matchers.

    example

    getDataTestidSelector('open', AttributeMatcher.CONTAINS) returns [data-testid*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getIdSelector

  • Returns id selector string. Supports =, *=, ^=, $= matchers.

    example

    getIdSelector('open', AttributeMatcher.CONTAINS) returns [id*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getNameSelector

  • Returns name selector string. Supports =, *=, ^=, $= matchers.

    example

    getNameSelector('open', AttributeMatcher.CONTAINS) returns [name*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getRoleSelector

  • Returns role selector string. Supports =, *=, ^=, $= matchers.

    example

    getRoleSelector('open', AttributeMatcher.CONTAINS) returns [role*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getSelectorWithAttributeType

getSkinPartSelector

  • Returns data-skinpart selector string. Supports =, *=, ^=, $= matchers.

    example

    getSkinPartSelector('open', AttributeMatcher.CONTAINS) returns [data-skinpart*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getSrcSelector

  • Returns src selector string. Supports =, *=, ^=, $= matchers.

    example

    getSrcSelector('Open', AttributeMatcher.CONTAINS) returns [src*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getTabSelector

  • Returns tab selector string. Supports =, *=, ^=, $= matchers.

    example

    getTabSelector('Open', AttributeMatcher.CONTAINS) returns [tab*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

getValueSelector

  • Returns value selector string. Supports =, *=, ^=, $= matchers.

    example

    getValueSelector('Open', AttributeMatcher.CONTAINS) returns [value*=open]

    Parameters

    • key: string

      Selector value string

    • Optional attributeMatcher: AttributeMatcher

      Matcher

    Returns string

isXpath

  • isXpath(selector: string): null | RegExpMatchArray
  • Checks if selector is XPath selector

    Parameters

    • selector: string

    Returns null | RegExpMatchArray

Waiters

Const wait

  • wait(ms: number): Promise<void>
  • wait<T>(ms: number, value: T): Promise<T>
  • Causes your script to wait for the given number of milliseconds.

    Parameters

    • ms: number

    Returns Promise<void>

  • Causes your script to wait for the given number of milliseconds.

    Type parameters

    • T

    Parameters

    • ms: number
    • value: T

    Returns Promise<T>

waitFor

  • Generic wait function that receives the function and polls it with the specific time interval until it will return true.

    Parameters

    Returns Promise<void>

waitForAnimation

  • waitForAnimation(context: DocumentContext, selector: string, options?: { killTimeout?: number }): Promise<ElementHandle<Element>>
  • Waits for element animation to stop happening. Checks that bounding and opacity computed styles are not changed during 1 second. If they changed - repeats cycle. If animation is still happened during killTimeout or ACTION_TIMEOUT - returns. Function returns ElementHandle.

    Parameters

    • context: DocumentContext

      Page or Frame

    • selector: string

      Selector

    • Optional options: { killTimeout?: number }

      timeout when node would be killed if animation is still happened

      • Optional killTimeout?: number

    Returns Promise<ElementHandle<Element>>

waitForCollectionLengthToBe

  • waitForCollectionLengthToBe(collection: () => Promise<any[]>, expectedLength: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection length to be equal defined number. If it is not after timeout - throws exception.

    Parameters

    • collection: () => Promise<any[]>

      Async function that returns array

        • (): Promise<any[]>
        • Returns Promise<any[]>

    • expectedLength: number

      Expected collection length

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionLengthToBeMoreThan

  • waitForCollectionLengthToBeMoreThan(collection: () => Promise<any[]>, moreThan: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection length to be more than defined number. If it is not after timeout - throws exception.

    Parameters

    • collection: () => Promise<any[]>

      Async function that returns array

        • (): Promise<any[]>
        • Returns Promise<any[]>

    • moreThan: number

      Min length - 1

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionLengthToBeNotLessThan

  • waitForCollectionLengthToBeNotLessThan(collection: () => Promise<any[]>, minLength: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection length to be not less than defined number. If it is after timeout - throws exception.

    Parameters

    • collection: () => Promise<any[]>

      Async function that returns array

        • (): Promise<any[]>
        • Returns Promise<any[]>

    • minLength: number

      Expected collection minimum length

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionNotToHaveItem

  • waitForCollectionNotToHaveItem<T>(func: () => Promise<T[]>, value: T, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection NOT to have object with type. If it is has after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T[]>

      Async function that returns array of objects with type

        • (): Promise<T[]>
        • Returns Promise<T[]>

    • value: T

      Item of same type as collection item that expected NOT to exist in collection

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionToBeEmpty

  • waitForCollectionToBeEmpty(collection: () => Promise<any[]>, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection length to be 0. If it is not after timeout - throws exception.

    Parameters

    • collection: () => Promise<any[]>

      Async function that returns array

        • (): Promise<any[]>
        • Returns Promise<any[]>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionToBeNotEmpty

  • waitForCollectionToBeNotEmpty(collection: () => Promise<any[]>, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection length to be NOT 0. If it is after timeout - throws exception.

    Parameters

    • collection: () => Promise<any[]>

      Async function that returns array

        • (): Promise<any[]>
        • Returns Promise<any[]>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCollectionToHaveItem

  • waitForCollectionToHaveItem<T>(func: () => Promise<T[]>, value: T, waitOptions?: WaitOptions): Promise<void>
  • Waits for collection to have object with type. If it is not after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T[]>

      Async function that returns array of objects with type

        • (): Promise<T[]>
        • Returns Promise<T[]>

    • value: T

      Item of same type as collection item that expected to exist in collection

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForCondition

  • waitForCondition(action: () => ActionReturnType, waitOptions?: WaitOptions, exceptionMessage?: string, withCallee?: () => any): Promise<void>
  • Similar method as waitFor, just another naming.

    Parameters

    • action: () => ActionReturnType

      Async function that returns true

    • Optional waitOptions: WaitOptions

      WaitOptions

    • Optional exceptionMessage: string

      Message in exception that would overrides default

    • Optional withCallee: () => any

      Function that is called for wait for condition (Needed for exception message, in case of when not highest level function is passed as 1st argument)

        • (): any
        • Returns any

    Returns Promise<void>

waitForConditionToBeFalsy

waitForConditionWithoutException

waitForFunctionNotToBeNull

  • waitForFunctionNotToBeNull<T>(func: () => Promise<T>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value NOT to be null. If it is after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type

        • (): Promise<T>
        • Returns Promise<T>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForFunctionNotToBeUndefined

  • waitForFunctionNotToBeUndefined<T>(func: () => Promise<T>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value NOT to be undefined. If it is after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type

        • (): Promise<T>
        • Returns Promise<T>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForFunctionToBeNull

  • waitForFunctionToBeNull<T>(func: () => Promise<T>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value to be null. If it is not after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type

        • (): Promise<T>
        • Returns Promise<T>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForFunctionToBeUndefined

  • waitForFunctionToBeUndefined<T>(func: () => Promise<T>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value to be undefined. If it is not after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type

        • (): Promise<T>
        • Returns Promise<T>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForFunctionValueToBeChanged

  • waitForFunctionValueToBeChanged<T>(func: () => Promise<T>, action: () => Promise<any>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value to be changed. Useful when you expect that value you get would be changed after some action. If it is NOT after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type which value you expect to be changed

        • (): Promise<T>
        • Returns Promise<T>

    • action: () => Promise<any>

      Async function that represents action after which change is expected

        • (): Promise<any>
        • Returns Promise<any>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForFunctionValueToBeChangedAndStabilized

  • waitForFunctionValueToBeChangedAndStabilized<T>(func: () => Promise<T>, action: () => Promise<any>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value to be changed and then not to change in some interval. Useful when you expect that value you get would be changed after some action and then there would be several temp states (animation, for ex.). If it is NOT after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type which value you expect to be changed

        • (): Promise<T>
        • Returns Promise<T>

    • action: () => Promise<any>

      Async function that represents action after which change is expected

        • (): Promise<any>
        • Returns Promise<any>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForObjectsNotToBeEqual

  • waitForObjectsNotToBeEqual<T>(actual: () => Promise<T>, expected: Promise<T> | T, withCallee?: () => Promise<any>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value NOT to be equal to another async value or value. If it is after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • actual: () => Promise<T>

      Async function with type which value you check. Contains exception catch and returns void in that case.

        • (): Promise<T>
        • Returns Promise<T>

    • expected: Promise<T> | T

      Async value or value that you expect NOT to be equal to function

    • Optional withCallee: () => Promise<any>

      Function that is called for wait for condition (Needed for exception message, in case of when not highest level function is passed as 1st argument)

        • (): Promise<any>
        • Returns Promise<any>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForObjectsToBeEqual

  • waitForObjectsToBeEqual<T>(actual: () => Promise<T>, expected: Promise<T> | T, withCallee?: () => Promise<any>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value to be equal to another async value or value. If it is NOT after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • actual: () => Promise<T>

      Async function with type which value you check. Contains exception catch and returns void in that case.

        • (): Promise<T>
        • Returns Promise<T>

    • expected: Promise<T> | T

      Async value or value that you expect to be equal to function

    • Optional withCallee: () => Promise<any>

      Function that is called for wait for condition (Needed for exception message, in case of when not highest level function is passed as 1st argument)

        • (): Promise<any>
        • Returns Promise<any>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForStringFunctionToContainString

  • waitForStringFunctionToContainString(func: () => Promise<string>, value: string, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function string value to contain string value. If it is not after timeout - throws exception.

    Parameters

    • func: () => Promise<string>

      Async function with return type: string

        • (): Promise<string>
        • Returns Promise<string>

    • value: string

      String value that function contains

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValueToBeEqualOrLessThan

  • waitForValueToBeEqualOrLessThan(func: () => Promise<number>, value: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function numeric value is equal or less than expected value. If it is not after timeout - throws exception.

    Parameters

    • func: () => Promise<number>

      Async function with return type: number

        • (): Promise<number>
        • Returns Promise<number>

    • value: number

      Number value that is equal or less than to function

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValueToBeEqualOrMoreThan

  • waitForValueToBeEqualOrMoreThan(func: () => Promise<number>, value: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function numeric value is equal or more than expected value. If it is not after timeout - throws exception.

    Parameters

    • func: () => Promise<number>

      Async function with return type: number

        • (): Promise<number>
        • Returns Promise<number>

    • value: number

      Number value that is equal or more than to function

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValueToBeLessThan

  • waitForValueToBeLessThan(func: () => Promise<number>, value: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function numeric value is less than expected value. If it is not after timeout - throws exception.

    Parameters

    • func: () => Promise<number>

      Async function with return type: number

        • (): Promise<number>
        • Returns Promise<number>

    • value: number

      Number value that is less than to function

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValueToBeMoreThan

  • waitForValueToBeMoreThan(func: () => Promise<number>, value: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function numeric value is more than expected value If it is not after timeout - throws exception.

    Parameters

    • func: () => Promise<number>

      Async function with return type: number

        • (): Promise<number>
        • Returns Promise<number>

    • value: number

      Number value that is more than to function

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValueToStopChanging

  • waitForValueToStopChanging<T>(func: () => Promise<T>, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function value is not changing during interval. If function throws an exception both times - return undefined (it's meant that it stopped changing) If it is still changing after timeout - throws exception.

    Type parameters

    • T

    Parameters

    • func: () => Promise<T>

      Async function with type

        • (): Promise<T>
        • Returns Promise<T>

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitForValuesToBeCloseTo

  • waitForValuesToBeCloseTo(actual: () => Promise<number>, expected: Promise<number> | number, delta: number, waitOptions?: WaitOptions): Promise<void>
  • Waits for async function numeric value is close to expected value by delta amount. |actual - expected| <= delta If it is not after timeout - throws exception.

    Parameters

    • actual: () => Promise<number>

      Async function with return type: number

        • (): Promise<number>
        • Returns Promise<number>

    • expected: Promise<number> | number

      Number value that is close to function

    • delta: number

      Precision

    • Optional waitOptions: WaitOptions

      WaitOptions

    Returns Promise<void>

waitWithAttempts

  • waitWithAttempts<T>(action: (...args: any) => Promise<T> | T | undefined, options?: WaitWithAttemptsOptions, exceptionMessage?: any): Promise<T>
  • Waits for function value is not equal undefined or custom value, using number of attempts. Returns function value or throws an exception.

    Type parameters

    • T

    Parameters

    • action: (...args: any) => Promise<T> | T | undefined

      Async function with type

        • (...args: any): Promise<T> | T | undefined
        • Parameters

          • Rest ...args: any

          Returns Promise<T> | T | undefined

    • Optional options: WaitWithAttemptsOptions

      WaitWithAttemptsOptions

    • Optional exceptionMessage: any

      Custom exception message that overrides default

    Returns Promise<T>

Generated using TypeDoc