View Source Improve this doc

getCurrentTabId

Retrieve the current window handle.

Usage

1
browser.getCurrentTabId();

Example

getCurrentTabId.js
1
2
3
4
5
6
7
8
it('should return the current tab id', function () {
browser.url('http://webdriver.io')

var tabId = browser.getCurrentTabId()
console.log(tabId)
// outputs something like the following:
// "CDwindow-C43FB686-949D-4232-828B-583398FBD0C0"
})

Returns

  • <String>: the window handle URL of the current focused window

Uses