From 131413e11bb32aaa0afb7bf43c743eb6d0449924 Mon Sep 17 00:00:00 2001 From: Nanne Baars Date: Sat, 17 Sep 2016 21:37:11 +0200 Subject: [PATCH] Fixed testcase failed open authentication scheme --- .../test/java/org/owasp/webgoat/plugins/WebGoatIT.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webgoat-container/src/test/java/org/owasp/webgoat/plugins/WebGoatIT.java b/webgoat-container/src/test/java/org/owasp/webgoat/plugins/WebGoatIT.java index 11515f4b7..62aab3847 100644 --- a/webgoat-container/src/test/java/org/owasp/webgoat/plugins/WebGoatIT.java +++ b/webgoat-container/src/test/java/org/owasp/webgoat/plugins/WebGoatIT.java @@ -14,6 +14,7 @@ import org.junit.runner.RunWith; 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.remote.CapabilityType; @@ -330,7 +331,12 @@ public class WebGoatIT implements SauceOnDemandSessionIdProvider { FluentWait wait = new WebDriverWait(driver, 15); // wait for a maximum of 15 seconds wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("lesson-title"), "Fail Open Authentication Scheme")); - WebElement user = driver.findElement(By.name("Username")); + wait = new FluentWait(driver) + .withTimeout(10, SECONDS) + .pollingEvery(2, SECONDS) + .ignoring(NoSuchElementException.class) + .ignoring(StaleElementReferenceException.class); + WebElement user = wait.until(ExpectedConditions.elementToBeClickable(By.name("Username"))); user.click(); user.sendKeys("Larry");