Get Attribute values using Webdriver
Submitted by harrydev on Sun, 02/08/2015 - 03:23There are cases where you want to get the attributes values and then perform any action.
In the below, if you see, button tag which has multiple attributes 'name', 'id', 'class' and 'aria-label' and has values for each attribute. To get the attribute value using selenium webdriver, we can use 'element.getAttribute(attributeName)'.
If we try to get the attribute value that doesn't exists for the tag, it will return null value.