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

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

Introduction

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

Prototype

public static ExpectedCondition<WebElement> presenceOfElementLocated(final By locator) 

Source Link

Document

An expectation for checking that an element is present on the DOM of a page.

Usage

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void browsePasswordPolicy() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a")).click();
    seleniumDriver.findElement(By.xpath("//div[@id='policies']/ul/li[2]/a")).click();
    seleniumDriver.findElement(By.xpath("//div[@id='password']/span/div/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);/*from www.ja  va2  s.  com*/
    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='key:textField']")));

    WebElement element = seleniumDriver.findElement(By.name("description:textField"));
    element.sendKeys("new description");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input[@type='submit']")).click();
    seleniumDriver.switchTo().defaultContent();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
    assertTrue(seleniumDriver.findElement(By.tagName("body")).getText()
            .contains("Operation executed successfully"));
}

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void browseWorkflowDef() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[5]/a/span")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='workflow']/div/span/img")));
}

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void setLogLevel() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[6]/a")).click();

    final Select select = new Select(
            seleniumDriver.findElement(By.xpath("//div[@id='core']/div/span/table/tbody/tr/td[2]/select")));
    select.selectByVisibleText("ERROR");

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='workflow']/div/span/img")));
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
    assertTrue(seleniumDriver.findElement(By.tagName("body")).getText()
            .contains("Operation executed successfully"));
}

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void createNotification() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();

    seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);//w  w w.jav  a  2 s. c  om

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));

    seleniumDriver.findElement(By.name("sender:textField")).sendKeys("test@syncope.it");

    seleniumDriver.findElement(By.name("subject:textField")).sendKeys("test@syncope.it");

    Select select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select")));
    select.selectByVisibleText("UserPlainSchema");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
    select.selectByVisibleText("fullname");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
    select.selectByVisibleText("optin");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
    select.selectByVisibleText("ALL");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
                    + "/option[text()='PROPAGATION']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
    select.selectByVisibleText("PROPAGATION");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
                    + "/option[text()='group']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
    select.selectByVisibleText("group");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
                    + "/option[text()='resource-db-sync']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']")));
    select.selectByVisibleText("resource-db-sync");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']")));

    seleniumDriver.findElement(By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input"))
            .click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a")).click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[4]/div/div/span/input")).click();

    wait.until(ExpectedConditions
            .elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));

    seleniumDriver.findElement(By.name("staticRecipients:multiValueContainer:view:0:panel:textField"))
            .sendKeys("syncope445@syncope.apache.org");

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div[4]/div/div[2]/label")));

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();

    seleniumDriver.switchTo().defaultContent();
}

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void createDisabledNotification() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();

    seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);//w  w  w.  jav  a2 s.c  om

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));

    seleniumDriver.findElement(By.name("sender:textField")).sendKeys("test@syncope.it");

    Select select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div[1]/div[3]/div[2]/span/select")));
    select.selectByVisibleText("UserPlainSchema");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
    select.selectByVisibleText("fullname");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
    select.selectByVisibleText("optin");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
    select.selectByVisibleText("ALL");

    // disable notification
    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[7]/div[2]/span/input")).click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
                    + "/option[text()='PROPAGATION']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
    select.selectByVisibleText("PROPAGATION");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
                    + "/option[text()='group']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
    select.selectByVisibleText("group");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
                    + "/option[text()='resource-db-sync']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']")));
    select.selectByVisibleText("resource-db-sync");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']")));

    seleniumDriver.findElement(By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input"))
            .click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a/span")).click();

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[4]/div/div/span/input")).click();

    wait.until(ExpectedConditions
            .elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));

    seleniumDriver.findElement(By.name("staticRecipients:multiValueContainer:view:0:panel:textField"))
            .sendKeys("syncope492@syncope.apache.org");

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div[4]/div/div[2]/label")));

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();

    seleniumDriver.switchTo().defaultContent();
}

From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java

License:Apache License

@Test
public void issueSYNCOPE446() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();

    seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);/*from  ww  w .ja  v  a  2 s.com*/

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));

    seleniumDriver.findElement(By.name("sender:textField")).sendKeys("syncope446@syncope.it");
    seleniumDriver.findElement(By.name("subject:textField")).sendKeys("Test issue Syncope 446");

    Select select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select")));
    select.selectByVisibleText("UserPlainSchema");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
    select.selectByVisibleText("email");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
    select.selectByVisibleText("optin");

    select = new Select(
            seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
    select.selectByVisibleText("ALL");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
                    + "/option[text()='REST']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
    select.selectByVisibleText("REST");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
                    + "/option[text()='GroupLogic']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
    select.selectByVisibleText("GroupLogic");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:successGroup']")));

    seleniumDriver.findElement(By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input"))
            .click();
    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[3]/span/div[4]/div/span/input")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']"
                    + "/option[text()='ENTITLEMENT']")));

    wait.until(ExpectedConditions.elementToBeClickable(
            By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:type']")));
    select.selectByVisibleText("ENTITLEMENT");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:property']"
                    + "/option[text()='GROUP_CREATE']")));

    select = new Select(seleniumDriver.findElement(
            By.xpath("//select[@name='aboutContainer:groupAbout:searchFormContainer:searchView:0:property']")));
    select.selectByVisibleText("GROUP_CREATE");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a/span")).click();
    seleniumDriver.findElement(By.xpath("//input[@name='recipientsContainer:checkRecipients:checkboxField']"))
            .click();

    wait.until(ExpectedConditions
            .elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));

    seleniumDriver.findElement(By.name("staticRecipients:multiValueContainer:view:0:panel:textField"))
            .sendKeys("syncope446@syncope.apache.org");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();

    seleniumDriver.switchTo().defaultContent();
}

From source file:org.apache.syncope.fit.console.reference.ConnectorITCase.java

License:Apache License

@Test
public void browseCreateModal() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a")).click();

    seleniumDriver.findElement(By.xpath("//div[3]/div[2]/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(("//iframe"))));
    seleniumDriver.switchTo().frame(0);/*w  w w.j  ava 2 s . c  o  m*/

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//form/div[2]/div/div/div[3]/div[2]/span/select")));

    Select select = new Select(
            seleniumDriver.findElement(By.xpath("//form/div[2]/div[1]/div[1]/div[2]/div[2]/span/select")));

    select.selectByValue("0");

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//select[@name='connectorName:dropDownChoiceField']/option[3]")));

    select = new Select(
            seleniumDriver.findElement(By.xpath("//form/div[2]/div[1]/div[1]/div[3]/div[2]/span/select")));
    select.selectByVisibleText("net.tirasa.connid.bundles.soap");

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[1]/a/span")).click();

    assertTrue(seleniumDriver.findElement(By.xpath("//form/div[2]/div/div/div[3]/div[2]")).isDisplayed());

    seleniumDriver.switchTo().defaultContent();

    seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}

From source file:org.apache.syncope.fit.console.reference.ConnectorITCase.java

License:Apache License

@Test
public void browseEditModal() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
    seleniumDriver.findElement(By.xpath("//tr[4]/td[7]/div/span[13]/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);//from  ww w .  j  a v a  2 s  . c  om

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));

    assertEquals("ConnInstance103", seleniumDriver
            .findElement(By.xpath("//input[@name='displayName:textField']")).getAttribute("value"));

    assertEquals("net.tirasa.connid.bundles.soap",
            (new Select(seleniumDriver
                    .findElement(By.xpath("//select[@name='connectorName:dropDownChoiceField']"))))
                            .getFirstSelectedOption().getText());

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a/span")).click();

    seleniumDriver.switchTo().defaultContent();

    seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}

From source file:org.apache.syncope.fit.console.reference.ConnectorITCase.java

License:Apache License

@Test
public void delete() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
    seleniumDriver.findElement(By.xpath("//tr[4]/td[7]/div/span[15]/a")).click();

    Alert alert = seleniumDriver.switchTo().alert();
    assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
    alert.accept();/*ww w .  java 2  s.  c  o m*/

    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
    assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Error: "));
}

From source file:org.apache.syncope.fit.console.reference.ConnectorITCase.java

License:Apache License

@Test
public void checkConnection() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

    seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
    seleniumDriver.findElement(By.xpath("//tr[2]/td[7]/div/span[13]/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);/*from   w ww .j av  a2  s .c o m*/

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//select[@name='version:dropDownChoiceField']")));

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a")).click();

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/a")));

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/a")).click();

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//div/ul/li/span[contains(text(),'Successful connection')]")));

    seleniumDriver.switchTo().defaultContent();
}