Example usage for org.openqa.selenium.support.ui ExpectedConditions titleIs

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions titleIs

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions titleIs.

Prototype

public static ExpectedCondition<Boolean> titleIs(final String title) 

Source Link

Document

An expectation for checking the title of a page.

Usage

From source file:applicationdriverlayer.pageobjects.squash.booking.ErrorPage.java

License:Apache License

@Override
protected void waitForLoadToComplete() {
    new WebDriverWait(driver, explicitWaitTimeoutSeconds).until(ExpectedConditions.titleIs("Grrr"));
}

From source file:com.asiainfo.tfsPlatform.modules.test.selenium.Selenium2.java

License:Apache License

/**
 * ?titletitle, timeout.
 */
public void waitForTitleIs(String title) {
    waitForCondition(ExpectedConditions.titleIs(title), DEFAULT_WAIT_TIME);
}

From source file:com.asiainfo.tfsPlatform.modules.test.selenium.Selenium2.java

License:Apache License

/**
 * ?titletitle, timeout??.
 */
public void waitForTitleIs(String title, int timeout) {
    waitForCondition(ExpectedConditions.titleIs(title), timeout);
}

From source file:com.cognifide.bdd.demo.po.login.LoginPage.java

License:Apache License

public boolean loginPageIsDisplayed() {
    try {//from   w  w  w . j  av  a 2s. co  m
        wait.withTimeout(pageTitleTimeout).until(ExpectedConditions.titleIs(PAGE_TITLE));
    } catch (TimeoutException te) {
        LOG.error(
                "TimeoutException thrown when waiting for page title to appear. Expected title: " + PAGE_TITLE,
                te);
        return false;
    }
    return true;
}

From source file:com.cognifide.bdd.demo.po.login.ProjectsScreen.java

License:Apache License

public boolean projectScreenIsDisplayed() {
    try {//w  w w.j a va2 s .c  o  m
        wait.withTimeout(pageTitleTimeout).until(ExpectedConditions.titleIs(PAGE_TITLE));
    } catch (TimeoutException te) {
        LOG.error("Timeout while waiting for page title to appear. Expected title: '{}'", PAGE_TITLE, te);
        return false;
    }
    return true;
}

From source file:com.cognifide.bdd.demo.po.login.ProjectsScreen.java

License:Apache License

public boolean projectScreenIsNotDisplayed() {
    try {/*from  w w w  .j a  v a  2 s.co m*/
        wait.withTimeout(pageTitleTimeout)
                .until(ExpectedConditions.not(ExpectedConditions.titleIs(PAGE_TITLE)));
    } catch (TimeoutException te) {
        LOG.error("Timeout while waiting for page title to be different than '{}'", PAGE_TITLE, te);
        return false;
    }
    return true;
}

From source file:com.cognifide.bdd.demo.po.login.ProjectsScreen.java

License:Apache License

public ProjectsScreen open() {
    webDriver.get(authorUrl + "/projects.html");
    wait.withTimeout(Timeouts.MEDIUM).until(ExpectedConditions.titleIs("AEM Projects"));
    return this;
}

From source file:com.cognifide.qa.bb.aem.page.AbstractPage.java

License:Apache License

/**
 * @return True if the page is displayed, false otherwise. <br>
 *         Assumes that the page is displayed when title of the currently displayed page is the
 *         same as the title stored in this object.
 *///from  w  w w  .  j  a  v  a 2  s.  c  om
public boolean isDisplayed() {
    return webElementUtils.isConditionMet(ExpectedConditions.titleIs(getPageTitle()), pageTitleTimeout);
}

From source file:com.fpt.datht.iap.AutoIAP.java

public static void loginGoogle(String user, String pass) {
    System.setProperty("webdriver.chrome.driver", "/chromedriver.exe");

    driver = new ChromeDriver();

    //  driver = new HtmlUnitDriver(true);
    driver.navigate().to("http://iap.fpt.edu.vn/hlogin.php?provider=Google");

    new WebDriverWait(driver, 360).until(ExpectedConditions.titleIs("Sign in - Google Accounts"));
    el = driver.findElement(By.id("Email"));
    el.sendKeys(user);/*from w  w  w  .j  av a2  s  .  co m*/
    el = driver.findElement(By.id("next"));
    el.click();

    new WebDriverWait(driver, 360).until(ExpectedConditions.presenceOfElementLocated(By.id("Passwd")));

    el = driver.findElement(By.id("Passwd"));
    el.sendKeys(pass);
    el = driver.findElement(By.id("signIn"));
    el.click();

}

From source file:com.fpt.datht.iap.AutoIAP.java

public static void getDataFromServer(String className) {
    int c = 0;//from  w  w w  .  j  av a 2  s.co m
    slots = new String[10];
    students = new LinkedList<>();
    new WebDriverWait(driver, 360).until(ExpectedConditions.titleIs("IAP"));
    driver.get("http://iap.fpt.edu.vn/activity");

    new WebDriverWait(driver, 360).until(ExpectedConditions.urlToBe("http://iap.fpt.edu.vn/activity/"));

    List<WebElement> els = driver.findElements(By.tagName("a"));
    System.out.println("Size a:" + els.size());
    for (WebElement e : els) {
        //  System.out.println(e.getText());
        if (e.getText().contains(className)) {

            slots[c] = e.getAttribute("href").replaceAll("http://iap.fpt.edu.vn/activity/index.php",
                    "http://iap.fpt.edu.vn/attendance/add.php");
            c++;
            count = c;
            // System.out.println(main);

        }
    }
    if (slots.length == 0)
        return;
    driver.get(slots[0]);

    try {
        new WebDriverWait(driver, 5)
                .until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//input[@type='submit']")));

    } catch (TimeoutException ex) {
        driver.get(slots[0].replaceAll("add.php", "edit.php"));

    }
    //Auto Check Slot 1
    if (autoCheckSlot1) {
        List<WebElement> elsInput = driver.findElements(By.xpath(".//input[@type='radio' and @value='1' ]"));
        autoCheckAll(elsInput);
    }

    //Wating for submit
    new WebDriverWait(driver, 5000)
            .until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//font[@color='green']")));
    driver.get(slots[0].replaceAll("add.php", "edit.php"));
    //GET All checked
    List<WebElement> elsInputChecked = driver
            .findElements(By.xpath(".//input[@type='radio' and @value='1' and @checked]"));

    System.out.println("Size input checked:" + elsInputChecked.size());

    elsInputChecked.stream().map((e) -> {
        Student student = new Student();
        student.name = e.getAttribute("name");
        return student;
    }).forEach(students::add);

}