Export (0) Print
Expand All

getElementAttribute method

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Gets the value of an attribute for a specified element.

  "name": "getElementAttribute",
  "parameters": {
    "elementId": {elementId},
    "name": "nameOfAttribute"
  "sessionId": "[sessionId]"




This is the command you're passing in. In this case, getElementAttribute.


This is a wrapper object in which you embed other information to be passed to WebDriver as parameters for the command.


The elementId of an HTML element in the document, generated by the findElement or findElements commands.


The name of the attribute you want to find the value of.


The sessionId value of the session you are targeting.

Return value

A JSON response object containing:

  • sessionId
  • status
  • value

    The value object will contain a string with the attribute's value.


For users of Internet Explorer Developer Channel

The first release of Internet Explorer Developer Channel contained an early preview of our WebDriver functionality. For that release only, all commands had to be wrapped in a command object. In the example below the command object wrapper is in bold:


  "command": {

    "name": "[command]",

    "parameters": {},

    "sessionId": "[sessionId]"



The command object wrapper is not used in general release versions of Internet Explorer, only the first release of Internet Explorer Developer Channel.

See also

WebDriver in Internet Explorer Developer Channel
WebDriver in IE11



© 2015 Microsoft