From 623544086d3fb64e43a277693c2e6628dbc7a0ca Mon Sep 17 00:00:00 2001 From: David Monllao Date: Tue, 16 Jul 2013 16:45:12 +0200 Subject: [PATCH] MDL-40690 behat: Ignore StaleElementReference exception Is another of the exceptions thrown by Selenium when it tries to interact with an element that disappeared from the DOM, in happens randomly when redirecting the user to another page with a wait period to show him/her a message. --- lib/tests/behat/behat_general.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index f15e5f66d61..d7e0ffbde9d 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -30,7 +30,8 @@ require_once(__DIR__ . '/../../behat/behat_base.php'); use Behat\Mink\Exception\ExpectationException as ExpectationException, Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException, Behat\Mink\Exception\DriverException as DriverException, - WebDriver\Exception\NoSuchElement as NoSuchElement; + WebDriver\Exception\NoSuchElement as NoSuchElement, + WebDriver\Exception\StaleElementReference as StaleElementReference; /** * Cross component steps definitions. @@ -84,6 +85,8 @@ class behat_general extends behat_base { $content = $metarefresh->getAttribute('content'); } catch (NoSuchElement $e) { return false; + } catch (StaleElementReference $e) { + return false; } // Getting the refresh time and the url if present.