RemoteWebElement GetAttribute Method WebDriver
Gets the value of the specified attribute for this element.

Namespace: OpenQA.Selenium.Remote
Assembly: WebDriver (in WebDriver.dll) Version: 2.35.0.0 (2.35.0.0)
Syntax

public string GetAttribute(
	string attributeName
)

Return Value

The attribute's current value. Returns a   if the value is not set.

Implements

IWebElement GetAttribute(String)
Exceptions

ExceptionCondition
OpenQA.Selenium StaleElementReferenceExceptionThrown when the target element is no longer valid in the document DOM.
Remarks

The GetAttribute(String) method will return the current value of the attribute, even if the value has been modified after the page has been loaded. Note that the value of the following attributes will be returned even if there is no explicit attribute on the element:
Attribute nameValue returned if not explicitly specifiedValid element types
checkedcheckedCheck Box
selectedselectedOptions in Select elements
disableddisabledInput and other UI elements
See Also