Skip to Content
Browser UtilsactiveTab

activeTab

Switch to a tab by its index. After calling this, all methods operate on the selected tab.

Signature

const page = await utils.activeTab(index)

Parameters

ParamTypeDescription
indexnumberZero-based tab index

Examples

await utils.activeTab(1); // switch to second tab await utils.click("#btn"); // click on second tab await utils.activeTab(0); // switch back to first tab await utils.activeDefault(); // or use activeDefault()

Error Handling

Throws if the tab index is out of range.

Last updated on