Tests if the element has an attribute with the given name and its value equals the specified value.
When the attribute has multiple values, the function tests if at least one of them equals the specified value.
This function is basically the same as the following expression:
element.hasAttr(attrName) &&
element.getAttrValues(attrName).contains(value)
When the tested value is not specified, the function will check if the attribute has any value at all. In that case, the equvalent expression is the following:
element.hasAttr(attrName) &&
element.getAttrValues(attrName).length() > 0
element
hasAttrValue(contextElement, attrName, value)
Note: If this parameter is null
, the function returns false
.
attrName
value
hasAttr(), getAttrValue(), checkValueByLPath()
(1) You may call this function in a more method-like style, e.g.:
element.hasAttrValue(attrName,value)
element.checkValueByLPath("@attrName",value)