windowHandle

Retrieve the current window handle.

Usage

1
browser.windowHandle();

Example

windowHandle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
it('should return window handle', function () {
browser.url('http://webdriver.io');

var handle = browser.windowHandle()
console.log(handle);
// outputs something like the following:
// {
// state: 'success',
// sessionId: 'e6782264-9eb1-427b-9250-d8302ac35161',
// hCode: 988127308,
// value: 'CDwindow-849D79B1-5CCB-4A1D-A217-5BA809D935F3',
// class: 'org.openqa.selenium.remote.Response',
// status: 0
// }
});