Script Execution Commands

Microsoft Edge supports the following WebDriver commands for script execution:

HTTP Request Commands
/session/{sessionId}/cookie Add Cookie, Delete Cookies, Get Cookies
/session/{sessionId}/cookie/{name} Delete Cookie, Get Cookie
/session/{sessionId}/execute} Execute Script
Name Add Cookie
Description Adds a cookie.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request POST /session/{sessionId}/cookie

JSON Parameters

{
    "cookie": {
        "name": "{name}",
        "value": "{value}"
    }
}

JSON Response Value

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

Delete Cookies

Name Delete Cookies
Description Delete all cookies visible to the current page.
Spec JSON Wire Protocol
HTTP Request DELETE /session/{sessionId}/cookie

JSON Parameters None.

JSON Response Value

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

Get Cookies

Name Get Cookies
Description Retrieves all cookies visible to the current page.
Spec JSON Wire Protocol
HTTP Request GET /session/{sessionId}/cookie

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": [
        {
            "name": "{name}",
            "value": "{value}",
            "path": "/",
            "domain": "{url}",
            "expiry": null,
            "secure": false,
            "httpOnly": false
        }
    ]
}
Name Delete Cookie
Description Deletes the cookie with the given name.
Spec W3C WebDriver, [JSON Wire Protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie/:name
)
HTTP Request DELETE /session/{sessionId}/cookie/{name}

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": {
        "name": "{name}",
        "value": "{value}",
        "path": "/",
        "domain": "{url}",
        "expiry": null,
        "secure": false,
        "httpOnly": false
    }
}
Name Get Cookie
Description Retrieves the cookie with the given name.
Spec W3C WebDriver
HTTP Request GET /session/{sessionId}/cookie/{name}

JSON Parameters None.

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": {
        "name": "{name}",
        "value": "{value}",
        "path": "/",
        "domain": "{url}",
        "expiry": null,
        "secure": false,
        "httpOnly": false
    }
}

Execute Script

Name Execute Script
Description Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
Spec W3C WebDriver, JSON Wire Protocol
HTTP Request POST /session/{sessionId}/execute

JSON Parameters

{
    "script": "return arguments[0].second;",
    "args": [
        {
            "first": "1st",
            "second": "2nd",
            "third": "3rd"
        }
    ]
}

JSON Response Value

{
    "sessionId": "{sessionId}",
    "status": 0,
    "value": "2nd"
}