MDL-58056 behat: Ensure form element exists

Before getting form field, ensure node is
visible. Else it may fail to get form
field
This commit is contained in:
Rajesh Taneja
2017-02-23 14:45:43 +08:00
parent de80be59bb
commit 3e340aba45
+3 -2
View File
@@ -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);
}