From e8ef0e4f6389930fe59d0a442fd5d5491eac4402 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 2 Feb 2016 17:12:09 +0800 Subject: [PATCH] MDL-52970 behat: don't set select value if already set In FF 44.0, it fails to click on submit button if select value is set to the original value --- lib/behat/form_field/behat_form_select.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/behat/form_field/behat_form_select.php b/lib/behat/form_field/behat_form_select.php index 19e0cf02dad..1c9c1f8cfb9 100644 --- a/lib/behat/form_field/behat_form_select.php +++ b/lib/behat/form_field/behat_form_select.php @@ -78,6 +78,17 @@ class behat_form_select extends behat_form_field { $afterfirstoption = true; } } else { + // If value is already set then don't set it again. + if ($this->field->getValue() == $value) { + return; + } else { + $opt = $this->field->find('named', array( + 'option', $this->field->getSession()->getSelectorsHandler()->xpathLiteral($value) + )); + if ($opt && ($this->field->getValue() == $opt->getValue())) { + return; + } + } // This is a single select, let's pass the last one specified. $this->field->selectOption(end($options)); }