Taiko
Documentation

Home / API Reference

closeTab

Closes the given tab with given URL or closes current tab.

Examples

# Closes the current tab.
await closeTab()
# Closes all the tabs with Title 'Open Source Test Automation Framework | Gauge'.
await closeTab('Open Source Test Automation Framework | Gauge')
# Closes all the tabs with URL 'https://gauge.org'.
await closeTab('https://gauge.org')
# Closes all the tabs with Regex Title 'Go*gle'
await closeTab(/Go*gle/)
# Closes all the tabs with Regex URL '/http(s?):\/\/(www?).google.(com|co.in|co.uk)/'
await closeTab(/http(s?):\/\/(www?).google.(com|co.in|co.uk)/)

Parameters


targetUrl string

URL/Page title of the tab to close.

Default value
undefined

Returns

Promise<void>