MDL-58948 behat: catch ElementNotFoundException

Another valid exception that can be thrown from a Mink driver
is the ElementNotFoundException when an element has gone missing.
This commit is contained in:
Mark Nielsen 2017-06-28 11:36:36 -07:00
parent 3cf0d01a61
commit f5459099ae
2 changed files with 5 additions and 0 deletions

View file

@ -114,6 +114,8 @@ class behat_form_field {
// If the JS handler attached to keydown or keypress destroys the element // If the JS handler attached to keydown or keypress destroys the element
// the later events may trigger errors because form element no longer exist // the later events may trigger errors because form element no longer exist
// or is not visible. Ignore such exceptions here. // or is not visible. Ignore such exceptions here.
} catch (\Behat\Mink\Exception\ElementNotFoundException $e) {
// Other Mink drivers can throw this for the same reason as above.
} }
} }

View file

@ -634,6 +634,9 @@ class behat_general extends behat_base {
} catch (WebDriver\Exception\NoSuchElement $e) { } catch (WebDriver\Exception\NoSuchElement $e) {
// Do nothing just return, as element is no more on page. // Do nothing just return, as element is no more on page.
return true; return true;
} catch (ElementNotFoundException $e) {
// Do nothing just return, as element is no more on page.
return true;
} }
} }