@christian-bromann/webdriverio
Version:
A nodejs bindings implementation for selenium 2.0/webdriver
39 lines (36 loc) • 1.18 kB
JavaScript
/**
*
* Retrieve the list of all window handles available to the session.
*
* <example>
:windowHandlesAsync.js
browser
.url('http://localhost/one.html')
.newWindow('http://localhost/two.html')
.windowHandles().then(function(windowHandles) {
console.log('windowHandles:');
// Outputs something like
// {
// state: 'success',
// sessionId: '31dc8253-a27e-4bae-8d20-338d6b0541c9',
// hCode: 273402755,
// value:
// [ 'CDwindow-CBFE1412-8D46-495C-96B4-42E04F9153C0',
// 'CDwindow-BD7BE568-52F2-4552-B834-FE2D041DCE5B' ],
// class: 'org.openqa.selenium.remote.Response',
// status: 0
// }
})
* </example>
*
* @returns {String[]} a list of window handles
*
* @see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-get-window-handles
* @type protocol
*
*/
let windowHandles = function () {
// ToDo fix path according to new Webdriver standard
return this.requestHandler.create('/session/:sessionId/window_handles')
}
export default windowHandles