---
name: Get Element CSS Value
short_description: Query the value of a web element's computed CSS property

description: 
  |
    The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).

    This command only applies to webview contexts

example_usage:
  java:
    |
      List<MobileElement> element = (MobileElement) driver.findElementById("SomeId");
      String cssProperty = element.getCssValue("style");
  python:
    |
      cssProperty = self.driver.find_element_by_accessibility_id('SomeId').value_of_css_property("style")
  javascript_wd:
    |
      let element = await driver.elementById("SomeId");
      let cssProperty = await element.getComputedCss();
  javascript_wdio:
    |
      let cssProperty = driver.getCssProperty("~SomeId", "style");
  ruby:
    |
      @driver.find_element(:id, 'SomeId').css_value
  php:
    |
      // TODO PHP sample
  csharp:
    |
      // TODO C# sample

client_docs:
  java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getCssValue--"
  python: "http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webelement.WebElement.value_of_css_property"
  javascript_wdio: "http://webdriver.io/api/property/getCssProperty.html"
  javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L1447"
  ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Element:css_value"
  php: "https://github.com/appium/php-client/" # TODO PHP documentation link
  csharp: "https://github.com/appium/appium-dotnet-driver/" # TODO Dotnet documentation link  

# TODO: Confirm if all the drivers support this
driver_support:
  ios:
    xcuitest: true
    uiautomation: true
  android:
    uiautomator2: true
    uiautomator: true
  mac:
    mac: true
  windows:
    windows: true
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/:session_id/elements/:element_id/css/:property_name
  method: GET
  url_parameters:
    - name: session_id
      description: ID of the session to route the command to
    - name: element_id
      description: ID of the element to get the property from
    - name: property_name
      description: Name of the CSS property
  response:
    - type: string
      description: Value of the CSS property

# Links to specifications. Should link to at least one specification
specifications:
  w3c: https://www.w3.org/TR/webdriver/#dfn-get-element-css-value
  jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidcsspropertyname
