Repository: tapestry-5 Updated Branches: refs/heads/master 1c71aec76 -> 77f6f1005
Trying again to avoid StaleElementReferenceException Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/77f6f100 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/77f6f100 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/77f6f100 Branch: refs/heads/master Commit: 77f6f1005cbebde476e85702095656cdaada893a Parents: 1c71aec Author: Thiago H. de Paula Figueiredo <[email protected]> Authored: Thu Nov 29 20:23:15 2018 -0200 Committer: Thiago H. de Paula Figueiredo <[email protected]> Committed: Thu Nov 29 20:23:15 2018 -0200 ---------------------------------------------------------------------- .../java/org/apache/tapestry5/test/SeleniumTestCase.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/77f6f100/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java ---------------------------------------------------------------------- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java index d7ac8ab..6592420 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java @@ -20,6 +20,7 @@ import com.thoughtworks.selenium.webdriven.WebDriverCommandProcessor; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; @@ -1392,13 +1393,18 @@ public abstract class SeleniumTestCase extends Assert implements Selenium { return; } + // Attempt to fix StaleElementReferenceException: The element reference of <body> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed // waitForCondition(ExpectedConditions.attributeToBe(body, "data-page-initialized", "true"), 30); - waitForCssSelectorToAppear("body[data-page-initialized='true'"); + waitForCssSelectorToAppear("body[data-page-initialized='true']"); } catch (NoSuchElementException e) { // no body element found, there's nothing to wait for + } catch (StaleElementReferenceException e) { + e.printStackTrace(); + System.out.println("Continuing execution after exception above."); } + } @Override
