---
name: Set Cookie
short_description: Set a cookie (Web context only)

example_usage:
  java:
    |
      driver.manage().addCookie(new Cookie("foo", "bar"));
  python:
    |
      self.driver.add_cookie({name: 'foo', value: 'bar'})
  javascript_wd:
    |
      let cookies = await driver.setCookie({name: 'foo', value: 'bar'});
  javascript_wdio:
    |
      driver.cookie('post', {
        name: 'myCookie',
        value: 'some content'
      });
  ruby:
    |
      @driver.add_cookie(:name => 'foo', :value => 'bar')
  php:
    |
      // TODO PHP sample
  csharp:
    |
      // TODO C# sample

client_docs:
  java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/remote/RemoteWebDriver.RemoteWebDriverOptions.html#addCookie-org.openqa.selenium.Cookie-"
  python: "http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.add_cookie"
  javascript_wdio: "http://webdriver.io/api/protocol/cookie.html"
  javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L1971"
  ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Options:add_cookie"
  php: "https://github.com/appium/php-client/" # TODO PHP documentation link
  csharp: "https://github.com/appium/appium-dotnet-driver/" # TODO Dotnet documentation link

# Driver support by platform
driver_support:
  ios:
    xcuitest: false
    uiautomation: false
  android:
    uiautomator2: false
    uiautomator: false
  mac:
    mac: false
  windows:
    windows: false
client_support:
  java: true
  python: true
  ruby: true
  php: true
  csharp: true
  javascript_wd: true
  javascript_wdio: true
  

# Information about the HTTP endpoints
endpoint:
  url: /wd/hub/session/:sessionId/cookie
  method: POST
  url_parameters:
    - name: session_id
      description: ID of the session to route the command to
  json_parameters:
    - name: cookie
      type: object
      description: The cookie to add

# Links to specifications. Should link to at least one specification
specifications: 
  w3c: https://www.w3.org/TR/webdriver/#dfn-delete-cookie
  jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidcookie
