From 3e340aba45e006b770e683dc382c4ad8600a00ab Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 23 Feb 2017 14:13:54 +0800 Subject: [PATCH] MDL-58056 behat: Ensure form element exists Before getting form field, ensure node is visible. Else it may fail to get form field --- lib/tests/behat/behat_forms.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tests/behat/behat_forms.php b/lib/tests/behat/behat_forms.php index 2b362dfff84..229b5c7e62b 100644 --- a/lib/tests/behat/behat_forms.php +++ b/lib/tests/behat/behat_forms.php @@ -241,8 +241,9 @@ class behat_forms extends behat_base { * @return void */ public function i_set_the_field_with_xpath_to($fieldxpath, $value) { - $fieldNode = $this->find('xpath', $fieldxpath); - $field = behat_field_manager::get_form_field($fieldNode, $this->getSession()); + $fieldnode = $this->find('xpath', $fieldxpath); + $this->ensure_node_is_visible($fieldnode); + $field = behat_field_manager::get_form_field($fieldnode, $this->getSession()); $field->set_value($value); }