Skip to content

tap()

Fetches an element with the given selector, scrolls it into view if needed, and then taps on the element. If there’s no element matching selector, the method throws an error.

Examples

await tap('Gmail')
await tap(link('Gmail'))
tap(link('Gmail'), { waitForNavigation: true, waitForEvents: ['firstMeaningfulPaint'],  force: true });
tap(link('Gmail'), {}, below('title'))

Parameters

Name Type Description
selector selector
options Object Default: {}.
options.waitForNavigation boolean - Wait for navigation after the click. Default navigation timeout is 15 seconds, to override pass { navigationTimeout: 10000 } in options parameter. Default: true.
options.force boolean Set to true to perform action on hidden/disabled elements. Default: false.
options.waitForEvents Array Events available to wait for [‘DOMContentLoaded’, ‘loadEventFired’, ‘networkAlmostIdle’, ‘networkIdle’, ‘firstPaint’, ‘firstContentfulPaint’, ‘firstMeaningfulPaint’, ‘targetNavigated’] Default: [].
args Array Proximity selectors

Returns

Type Description
Promise<void>