[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-dev
Subject:    tapestry-5 git commit: improve wait for page load
From:       jkemnade () apache ! org
Date:       2017-11-03 10:53:40
Message-ID: 1c31764ec83f4bb9869c5d503a8282b6 () git ! apache ! org
[Download RAW message or body]

Repository: tapestry-5
Updated Branches:
  refs/heads/master 9c5e8abc4 -> adf455bd9


improve wait for page load


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/adf455bd
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/adf455bd
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/adf455bd

Branch: refs/heads/master
Commit: adf455bd9d3bd49a41472e891213d640e159742a
Parents: 9c5e8ab
Author: Jochen Kemnade <jkemnade@apache.org>
Authored: Fri Nov 3 11:53:09 2017 +0100
Committer: Jochen Kemnade <jkemnade@apache.org>
Committed: Fri Nov 3 11:53:09 2017 +0100

----------------------------------------------------------------------
 .../apache/tapestry5/test/SeleniumTestCase.java   | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/adf455bd/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 \
                4a64591..a1fba91 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
@@ -19,6 +19,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.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.firefox.FirefoxDriver;
@@ -1377,15 +1378,20 @@ public abstract class SeleniumTestCase extends Assert \
                implements Selenium
         // In a limited number of cases, a "page" is an container error page or raw \
                HTML content
         // that does not include the body element and data-page-initialized element. \
                In those cases,
         // there will never be page initialization in the Tapestry sense and we \
                return immediately.
-
-        if (!isElementPresent("css=body[data-page-initialized]"))
+        try
         {
-            return;
-        }
-
+            WebElement body = webDriver.findElement(By.cssSelector("body"));
 
-        waitForCondition(ExpectedConditions.attributeToBe(By.cssSelector("body"), \
"data-page-initialized", "true"), 30); +            if \
(body.getAttribute("data-page-initialized") == null) +            {
+                return;
+            }
 
+            waitForCondition(ExpectedConditions.attributeToBe(body, \
"data-page-initialized", "true"), 30); +        } catch (NoSuchElementException e)
+        {
+            // no body element found, there's nothing to wait for
+        }
     }
 
     @Override


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic