.switchWindow() Suggest edits
Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
To find out the window handle use windowHandles
command
Parameters
Name | Type | description |
---|---|---|
handleOrName |
string | The server assigned window handle or the name attribute. |
callback Optional |
function | Optional callback function to be called when the command finishes. |
Usage
this.demoTest = function (browser) {
browser.windowHandles(function(result) {
var handle = result.value[0];
browser.switchWindow(handle);
});
};
this.demoTestAsync = async function (browser) {
const result = await browser.windowHandles();
var handle = result.value[0];
browser.switchWindow(handle);
};