Change focus to another window or close the current window. Shouldn't normally be used directly, instead .switchWindow() and .closeWindow() should be used.

Syntax

.window(httpMethod, handleOrName, [callback])

Parameters

Name Type description
method string

The HTTP method to use. Can be either POST (change focus) or DELETE (close window).

handleOrName string

The window to change focus to.

callback
Optional
function

Optional callback function to be called when the command finishes.

W3C WebDriver spec: