Be more graceful for timeouts while Selenium
[vid.git] / vid-automation / src / main / java / org / onap / sdc / ci / tests / utilities / GeneralUIUtils.java
index c2c93e7..dd632d2 100644 (file)
@@ -642,13 +642,14 @@ public final class GeneralUIUtils {
     public static void waitForAngular2(){
        WebDriverWait wait = newWait(90);
        wait.until(AdditionalConditions.pageLoadWait());
+               waitForLoader(60);
        try {
-                       WebDriverWait briefWait = newWait(2);
+                       WebDriverWait briefWait = newWait(3);
                        briefWait.until(AdditionalConditions.angular2HasFinishedProcessing());
                } catch (TimeoutException | org.openqa.selenium.ScriptTimeoutException e) {
                        logger.info("Ignoring TimeoutException while waiting for angular2: {}", e, e);
+                       waitForLoader(30);
                }
-               waitForLoader(10);
     }
 
        public static Object getAllElementAttributes(WebElement element) {
@@ -826,4 +827,14 @@ public final class GeneralUIUtils {
                ultimateWait();
        }
 
+       public static void acceptDeadObjectException(Runnable todo) {
+               try {
+                       todo.run();
+               } catch (org.openqa.selenium.WebDriverException e) {
+                       if (!e.getMessage().startsWith("TypeError: can't access dead object")) {
+                               throw e;
+                       }
+               }
+       }
+
 }