portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asfgr...@apache.org
Subject [1/2] portals-pluto git commit: PLUTO-737: StaleElementReferenceException with selenium: stale element reference
Date Tue, 16 Oct 2018 16:30:07 GMT
Repository: portals-pluto
Updated Branches:
  refs/heads/master 9d056b6c9 -> 3e9bd7807


PLUTO-737: StaleElementReferenceException with selenium: stale element reference


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/e9c1e103
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/e9c1e103
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/e9c1e103

Branch: refs/heads/master
Commit: e9c1e1039baab1a95344c5554aea8d0d92dc4b52
Parents: 9d056b6
Author: vsingleton <vsingleton@gmail.com>
Authored: Thu Oct 11 11:07:42 2018 -0400
Committer: Neil Griffin <neil.griffin.scm@gmail.com>
Committed: Tue Oct 16 12:23:56 2018 -0400

----------------------------------------------------------------------
 .../portlet/tck/driver/TCKSimpleTestDriver.java | 34 +++++++++++++++-----
 1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/e9c1e103/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
index 1765d11..c3c11a6 100644
--- a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
+++ b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
@@ -455,9 +455,7 @@ public class TCKSimpleTestDriver {
          try {
             res = rels.get(0).getText();
          } catch(StaleElementReferenceException e) {
-            System.out.println(e.getClass().getName() + " caught when trying to use WebElements
found with the resultId.");
-	        WebDriverWait wdw = new WebDriverWait(driver, timeout);
-            wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
+            System.out.println(e.getClass().getName() + " caught when trying to use WebElements
found with " + resultId);
             rels = driver.findElements(By.id(resultId));
             res = rels.get(0).getText();
          }
@@ -466,9 +464,7 @@ public class TCKSimpleTestDriver {
          try {
             det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
          } catch(StaleElementReferenceException e) {
-            System.out.println(e.getClass().getName() + " caught when trying to use WebElements
found with the detailId.");
-	        WebDriverWait wdw = new WebDriverWait(driver, timeout);
-            wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(detailId)));
+            System.out.println(e.getClass().getName() + " caught when trying to use WebElements
found with " + detailId);
             dels = driver.findElements(By.id(detailId));
             det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
          }
@@ -523,7 +519,18 @@ public class TCKSimpleTestDriver {
             JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
             javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top
+ window.pageYOffset) - (window.innerHeight / 2));", wel);
          }
-         wel.click();
+         try {
+            wel.click();
+         } catch(StaleElementReferenceException e) {
+            System.out.println("setup link: " + e.getClass().getName() + " caught when trying
to use WebElements found with " + tcName);
+            wels = driver.findElements(By.name(tcName));
+            for (WebElement welly : wels) {
+               tcels = welly.findElements(By.id(setupId));
+               if (!tcels.isEmpty()) break;
+            }
+            wel = tcels.get(0);
+            wel.click();
+         }
          debugLines.add("   Clicked setup link.");
 
          WebDriverWait wdw = new WebDriverWait(driver, timeout);
@@ -554,7 +561,18 @@ public class TCKSimpleTestDriver {
             JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
             javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top
+ window.pageYOffset) - (window.innerHeight / 2));", wel);
          }
-         wel.click();
+         try {
+            wel.click();
+         } catch(StaleElementReferenceException e) {
+            System.out.println("action link: " + e.getClass().getName() + " caught when trying
to use WebElements found with " + tcName);
+            wels = driver.findElements(By.name(tcName));
+            for (WebElement welly : wels) {
+               tcels = welly.findElements(By.id(actionId));
+               if (!tcels.isEmpty()) break;
+            }
+            wel = tcels.get(0);
+            wel.click();
+         }
          WebDriverWait wdw = new WebDriverWait(driver, timeout);
          wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
          wels = driver.findElements(By.name(tcName));


Mime
View raw message