Window Commands

Microsoft Edge supports the following window-related WebDriver commands:

HTTP Request Commands
/session/{sessionId}/window Close Window, Switch To Window
/session/{sessionId}/window_handle Get Window Handle
/session/{sessionId}/window_handles Get Window Handles

Close Window

Name Close Window
Description Closes the current window.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request DELETE /session/{sessionId}/window

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": null
}

Switch To Window

Name Switch To Window
Description Changes focus to another window.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request POST /session/{sessionId}/window

JSON Parameters None.

JSON Response Value

{
    "name": "{windowHandle}"
}

Get Window Handle

Name Click
Description Retrieves the current window handle.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request GET /session/{sessionId}/window_handle

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": "{windowHandle}"
}

Get Window Handles

Name Get Window Handles
Description Retrieves the list of all window handles available to the session.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request POST /session/{sessionId}/element/{elementId}/value

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": [
        "{windowHandleOne}",
        "{windowHandleTwo}"
    ]

}