Script Execution Commands

Microsoft Edge supports the following WebDriver commands for script execution:

HTTP RequestCommands
/session/{sessionId}/cookieAdd Cookie, Delete Cookies, Get Cookies
/session/{sessionId}/cookie/{name}Delete Cookie, Get Cookie
/session/{sessionId}/execute}Execute Script

Add Cookie

NameAdd Cookie
DescriptionAdds a cookie.
SpecW3C WebDriver, JSON Wire Protocol
HTTP RequestPOST /session/{sessionId}/cookie

JSON Parameters

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

JSON Response Value

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

Delete Cookies

NameDelete Cookies
DescriptionDelete all cookies visible to the current page.
SpecJSON Wire Protocol
HTTP RequestDELETE /session/{sessionId}/cookie

JSON Parameters
None.

JSON Response Value

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

Get Cookies

NameGet Cookies
DescriptionRetrieves all cookies visible to the current page.
SpecJSON Wire Protocol
HTTP RequestGET /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
        }
    ]
}

Delete Cookie

NameDelete Cookie
DescriptionDeletes the cookie with the given name.
SpecW3C WebDriver, [JSON Wire Protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol#DELETE_/session/:sessionId/cookie/:name
)
HTTP RequestDELETE /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
    }
}

Get Cookie

NameGet Cookie
DescriptionRetrieves the cookie with the given name.
SpecW3C WebDriver
HTTP RequestGET /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

NameExecute Script
DescriptionInject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
SpecW3C WebDriver, JSON Wire Protocol
HTTP RequestPOST /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"
}