Wait for loading state or a locator or url.

Hierarchy

  • Action
    • Wait

Properties

abilityAlias?: string
callStack?: CallStackInfo[]

Methods - Factory

  • Wait for a specific event on page.

    Type Parameters

    • T

    Parameters

    Returns Wait

    new Wait instance

    Example

    simple call

    Wait.forEventOnPage<Download>('download');
    
  • Wait until the pageFunction returns a truthy value. It resolves to a JSHandle of the truthy value.

    Type Parameters

    • R
    • Arg

    Parameters

    Returns Wait

    new Wait instance

    Example

    const selector = '.foo';
    await actor.attemptsTo(
    Wait.forFunction(
    (selector) => !!document.querySelector(selector),
    selector
    );
    );
  • Wait for a specific status of the page.

    Parameters

    • state: "load" | "domcontentloaded" | "networkidle"

      either 'load', 'domcontentloaded' or 'networkidle'

    • Optional options: WaitForLoadStateActionOptions

    Returns Wait

    new Wait instance

    Example

    Wait.forLoadState('networkidle');
    
  • Wait for a specific locator to exist.

    Parameters

    Returns Wait

    new Wait instance

    Example

    simple call with just locator

    Wait.forLocator('myLocator');
    

    with options

    Wait.forLocator(
    'myLocator', {
    hasText: 'myText',
    subLocator: ['mySubLocator', { hasText: 'anotherText' } ]
    }
    );
  • Wait for request matching the url or predicate.

    Parameters

    • urlOrPredicate: string | RegExp | ((request) => boolean | Promise<boolean>)

      url or predicate to wait for

    • Optional options: WaitForRequestActionOptions

    Returns Wait

    new Wait instance

    Example

    Wait.forRequest('example.com');
    
  • Wait for response matching the url or predicate.

    Parameters

    • urlOrPredicate: string | RegExp | ((response) => boolean | Promise<boolean>)

      url or predicate to wait for

    • Optional options: WaitForResponseActionOptions

    Returns Wait

    new Wait instance

    Example

    Wait.forRequest('example.com');
    

Methods - Other

  • Parameters

    • entry: CallStackInfo

    Returns void

  • Parameters

    • calledWith: CallStackCalledWith

    Returns void

  • Set the alias which is used for an underlying ability

    Parameters

    • alias: undefined | string

      with which an ability was initialized

    Returns this

    current action

Methods - called internally

  • wait for either a specified loading state or for a locator to become visible/active or url.

    Parameters

    • actor: Actor

      the actor object

    Returns Promise<any>

    Returns when the required load state has been reached.