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");