Close Tab

Use the I.closeTab command to close the current active tab.

After the tab is closed, the window will automatically switch to the previous tab.

Note that this command will be ignored if the current tab is the only tab open.

// First, go to google.com
I.goTo("https://google.com")

// Then, open a new tab, and go to wikipedia.com
// The test browser will automatically switch to the new tab.
I.goTo("https://wikipedia.com", {newTab: true})

// Close the current tab (wikipedia.com)
// This will automatically switch to the previous tab (google.com)
I.closeTab()
Last Updated: