getTabIds

Retrieve a list of all window handles available in the session. You can use these handles to switch to a different tab.

Usage

1
browser.getTabIds();

Example

getTabIds.js
1
2
3
4
5
6
7
8
9
10
it('should get the source of the html document', function () {
browser.url('http://webdriver.io');

var tabIds = browser.getTabIds();
console.log(tabIds); // outputs: ['f9b387e0-99bd-11e6-8881-d3174a61fdce']

browser.newWindow('http://google.com');
tabIds = browser.getTabIds();
console.log(tabIds); // outputs: ['f9b387e0-99bd-11e6-8881-d3174a61fdce', 'fb4e9a40-99bd-11e6-8881-d3174a61fdce' ]
});

Returns

  • <String[]>: a list of window handles

Uses