Value assertion (valueIs, valueContains, ...)

in Japanese(日本語)

Checks on an element's value (e.g. the content of a text field), as opposed to its label. Same shape as Text Assertion.

The target is always "the element grabbed last" — selectors are not passed to these commands. First grab the element with select (or exist / tap / etc.), then verify it:

select("#email").valueIs("test@example.com")             // chain onto the return value
select("#email"); lastElement.valueIs("test@example.com") // explicit lastElement
select("#email"); valueIs("test@example.com")             // implicit (the last grabbed element)

Arguments are (expected, requireVisible:, strict:, waitSeconds:) for the positive forms and (expected, strict:, waitSeconds:) for the negative forms, and (strict:, waitSeconds:) for the empty forms (valueMatchesDateFormat takes no strict: — see the table below). There is no form that takes a selector. For the strings the implicit form cannot take as expected values, see Text Assertion.

Functions

function negation comparison
select(selector).valueIs(expected, requireVisible:, strict:, waitSeconds:) valueIsNot(expected, strict:, waitSeconds:) exact match
valueContains(expected, requireVisible:, strict:, waitSeconds:) valueContainsNot(expected, strict:, waitSeconds:) substring match
valueStartsWith(expected, requireVisible:, strict:, waitSeconds:) valueStartsWithNot(expected, strict:, waitSeconds:) prefix match
valueEndsWith(expected, requireVisible:, strict:, waitSeconds:) valueEndsWithNot(expected, strict:, waitSeconds:) suffix match
valueMatches(pattern, requireVisible:, strict:, waitSeconds:) valueMatchesNot(pattern, strict:, waitSeconds:) regular expression (substring; use ^…$ for a full match)
valueMatchesDateFormat(format, requireVisible:, waitSeconds:) — DateFormatter format string
valueIsNotEmpty(strict:, waitSeconds:) valueIsEmpty(strict:, waitSeconds:) non-empty / empty

Comparison follows the same "same if it looks the same" rule as text assertions (strict: to disable it) — see Text Assertion for the full rule.

Example

select("#email").valueIs("test@example.com")
select("#email").valueContains("@example.com")

Notes