has_attr {selenider} | R Documentation |
Does an element's attribute match a value?
Description
has_attr()
checks that an element's attribute matches a value, while
attr_contains()
checks that an element's attribute contains a value.
has_value()
is a shortcut for has_attr("value")
: it checks that an
element's value matches a string or number.
Usage
has_attr(x, name, value)
attr_contains(x, name, value)
has_value(x, value)
Arguments
x |
A |
name |
The name of the attribute. |
value |
The value of the attribute. For |
Value
A boolean value: TRUE or FALSE.
See Also
Other conditions:
has_css_property()
,
has_length()
,
has_name()
,
has_text()
,
is_enabled()
,
is_present()
,
is_visible()
Examples
html <- "
<input class='myclass' value='1.0' data-customattr='Custom attribute text'>
"
session <- minimal_selenider_session(html)
has_attr(s("input"), "class", "myclass")
has_attr(s("input"), "value", 1)
has_value(s("input"), 1)
attr_contains(s("input"), "data-customattr", "Custom attribute")
[Package selenider version 0.4.0 Index]