Taiko
Documentation

Home / API Reference

openTab

Launches a new tab. If url is provided, the new tab is opened with the url loaded.

Examples

await openTab('https://taiko.dev')
await openTab() # opens a blank tab.
await openTab('https://taiko.dev', {name: 'taiko'}) # Tab with identifier

Parameters


targetUrl string

Url of page to open in newly created tab.

Default value
undefined

options

options.waitForNavigation boolean

Wait for navigation after the reload. Default navigation timeout is 5000 milliseconds, to override pass { navigationTimeout: 10000 } in options parameter.

Default value
true

options.name string

Tab identifier


options.navigationTimeout number

Navigation timeout value in milliseconds for navigation after click. Accepts value in milliseconds.

Default value
5000

options.waitForStart number

time to wait to check for occurrence of page load events. Accepts value in milliseconds.

Default value
100

options.waitForEvents Array<string>

Page load events to implicitly wait for. Events available to wait for ['DOMContentLoaded', 'loadEventFired', 'networkAlmostIdle', 'networkIdle', 'firstPaint', 'firstContentfulPaint', 'firstMeaningfulPaint', 'targetNavigated']

Default value
[]

Returns

Promise<void>