Search code examples
javaseleniumrobotframeworkwebdriverwaitselenium2library

What is the equivalent ExpectedCondition of "Wait Until Page Contains" of robot framework in Java


I know there are types of wait in java

Implicit wait-

driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS)

Explicit wait-

WebDriverWait wait = new WebDriverWait(driver, explicitWaitSec);
        wait.until(ExpectedConditions.elementToBeClickable(element));

Fluent wait-

Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)                            
        .withTimeout(30, TimeUnit.SECONDS)          
        .pollingEvery(5, TimeUnit.SECONDS)          
        .ignoring(NoSuchElementException.class);

, but I am confused which of the waits and expected conditions will serve me closest to Wait Until Page Contains keyword in Robot Framework?


Solution

  • There is no direct analog, that's a capability developed explicitly in in Robot Framework.
    In the same time, you can achieve it with ExpectedCondition's presenceOfElementLocated() with explicit/fluent wait (the latter is just more customizable version of the first, btw).

    For a locator, use this xpath:

    //*[contains(., "Your Text Here")]
    

    This is what Robotf Framework actually does, quite clever I must admit.