.switchWindow()
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 window_handles
protocol action
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.window_handles(function(result) { var handle = result.value[0]; //获取第一个窗口句柄 browser.switchWindow(handle); }); };