diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index f987b015738..7965f49f5f5 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -268,7 +268,7 @@ XPATH XPATH , 'date_time' => << [ 'moodle' => 'contains(./@aria-label, %locator%)', ], + '%exactTagTextMatch%' => [ + // This is based upon the upstream tagTextMatch but performs an exact match rather than a loose match using + // contains(). + // If possible we should only use exact matches for any new form fields that we add. + 'moodle' => 'normalize-space(text())=%locator%', + ], ]; /** @var List of deprecated selectors */