Skip to content

I.closeTab()

Closes the active browser tab.

INFO

When the active tab is closed, the test automatically switches focus to the tab immediately to the right. There is no need to explicitly switch tabs after calling I.closeTab().

If there is only one tab open, this command is ignored.

Usage

js
I.closeTab()

Example

js
I.goTo("https://example.com", { newTab: true })
// current page "https://example.com"

I.goTo("https://example.com/help", { newTab: true })
// current page is "https://example.com/help"

I.closeTab()
// current page is "https://example.com"

In the example above, the second tab is closed and execution continues on the first tab.