Function getText

Returns text from an element. For inputs use getValue instead.

const title = await getText(ctx, 'h1[id="title"]');

Context object.

The element selector for which to return text.

Element text content as a string.

  • Returns the value of a form element.

    Parameters

    • ctx: Context

      Context object.

    • selector: string

      The element selector for which to return value.

    • Optionaloptions: WaitForSelectorOptions

    Returns Promise<null | string>

    The value of the form element as a string.

    const firstName = await getValue(ctx, 'input[name="firstName"]');