function toWindow(tab){
browser.getAllWindowHandles().then(function (handles) {
browser.switchTo().window(handles[tab]);
return handles.length;
});
}
console.log(toWindow(1));
My expected output: should display the total count of opened tabs in a browser.
Solutions I have tried:
- make a global variable to receive the handles.length value - still
undefined - add return before
browser.getAllWindowHandles()... stillundefined