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)
However, it will work faster than that expression.

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
Parameters:

element

The element whose attribute is checked. If not specified, the generator context element is assumed, i.e. the same as the call: hasAttrValue(contextElement, attrName, value)

Note: If this parameter is null, the function returns false.

attrName
The attribute name
value
The value to test
See Also:
hasAttr(), getAttrValue(), checkValueByLPath()
Tips:

(1) You may call this function in a more method-like style, e.g.:

element.hasAttrValue(attrName,value)
(2) Using Location Path, the result returned by this function can also be obtained by the following call:
element.checkValueByLPath("@attrName",value)
(however, it will work more slowly).