From eba3553ec00cb15a960663cf516186c5c5775299 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 26 Apr 2013 16:27:27 +0800 Subject: [PATCH] IDEMPIERE-92 Implement Selenium testing framework. Fixed "org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Element is no longer attached to the DOM" --- .../src/fitlibrary/zk/ZkFixture.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.idempiere.ui.zk.selenium/src/fitlibrary/zk/ZkFixture.java b/org.idempiere.ui.zk.selenium/src/fitlibrary/zk/ZkFixture.java index a5ff6c1fc6..8dadb874eb 100644 --- a/org.idempiere.ui.zk.selenium/src/fitlibrary/zk/ZkFixture.java +++ b/org.idempiere.ui.zk.selenium/src/fitlibrary/zk/ZkFixture.java @@ -42,8 +42,8 @@ public class ZkFixture extends SpiderFixture { } @Override - public boolean withSelect(String locator, final boolean select) { - Widget widget = new Widget(locator); + public boolean withSelect(final String locator, final boolean select) { + final Widget widget = new Widget(locator); final WebElement element = widget.$n(webDriver, "real"); if (element.isSelected()) { if (!select) { @@ -58,7 +58,9 @@ public class ZkFixture extends SpiderFixture { ensureBecomes(new PollForWithError() { @Override public boolean matches() { - return element.isSelected() == select; + //search again to avoid StaleElementReferenceException + final WebElement e = widget.$n(webDriver, "real"); + return e.isSelected() == select; } @Override public String error() {