diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 22628a422b6..5b3378cacc2 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -394,7 +394,12 @@ class behat_forms extends behat_base { ); if (!$this->running_javascript()) { - $actions[] = new Given('I press "' . get_string('go') . '"'); + // Press button in the specified select container. + $containerxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' singleselect ') and " . + ".//label[contains(normalize-space(string(.)), '" . $singleselect . "')]]"; + + $actions[] = new Given('I click on "' . get_string('go') . '" "button" in the "' . $containerxpath . + '" "xpath_element"'); } return $actions;