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

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

public string GetAttribute(
	string attributeName
)

Parameters

attributeName
Type: SystemString
The name of the attribute.

Return Value

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

Implements

IWebElementGetAttribute(String)
Exceptions

ExceptionCondition
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

Reference