Skip to content

Commit

Permalink
MDL-53623 behat: catch expection if failed to trigger event
Browse files Browse the repository at this point in the history
Inline editing element might hide before
event is triggred, so don't trigger exception
if exception happens
  • Loading branch information
Rajesh Taneja committed Mar 29, 2016
1 parent 0114ca3 commit 225265b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/behat/form_field/behat_form_select.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ public function set_value($value) {
$browser = \Moodle\BehatExtension\Driver\MoodleSelenium2Driver::getBrowser();
if (!$singleselect && ($browser == 'phantomjs')) {
$script = "Syn.trigger('change', {}, {{ELEMENT}})";
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
try {
$this->session->getDriver()->triggerSynScript($this->field->getXpath(), $script);
} catch (Exception $e) {
// No need to do anything if element has been removed by JS.
// This is possible when inline editing element is used.
}
}
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
}
Expand Down

0 comments on commit 225265b

Please sign in to comment.