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.GroupITCase.java

License:Apache License

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

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

    seleniumDriver// www  . j a  va 2 s.  c  o  m
            .findElement(By.xpath(
                    "//div/div/span/div/div/div/div/div[2]/div[2]/div[2]/div/div[2]/div[3]/div/span[2]/a/span"))
            .click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='delete icon']")));

    seleniumDriver.findElement(By.xpath("//img[@alt='delete icon']")).click();

    Alert alert = seleniumDriver.switchTo().alert();
    assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
    alert.accept();
}

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

License:Apache License

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

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[contains(text(),'Search')]")));

    seleniumDriver.findElement(By.xpath("//span[contains(text(),'Search')]")).click();
    Select select = new Select(seleniumDriver.findElement(By.xpath("//td[2]/select")));
    select.selectByVisibleText("RESOURCE");

    wait.until(ExpectedConditions//  w  w  w. j a  va2 s  .  co m
            .presenceOfElementLocated(By.xpath("//td[3]/select[option='ws-target-resource-2']")));

    select = new Select(seleniumDriver.findElement(By.xpath("//td[3]/select")));
    select.selectByVisibleText("ws-target-resource-2");
    seleniumDriver.findElement(By.xpath("//form/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//div[3]/div[2]/div[2]/span/div[1]/span[1]/span/form/span/table/tbody/tr/td[3]/div")));
}

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

License:Apache License

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

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
    seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[8]/div/span[13]/a")).click();

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

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

    seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div[2]/div/a"))
            .click();
    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div/select")));

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

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

    seleniumDriver.switchTo().defaultContent();
    wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(
            By.xpath("//div[7]/form/div/div[2]/div/div/div/div[2]/div/div/iframe")));

    wait.until(ExpectedConditions.presenceOfElementLocated(By.name("reportletClass:dropDownChoiceField")));

    select = new Select(seleniumDriver.findElement(By.name("reportletClass:dropDownChoiceField")));
    select.selectByVisibleText(StaticReportletConf.class.getName());

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

    seleniumDriver.switchTo().defaultContent();

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

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

License:Apache License

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

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

    seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[8]/div/span[6]/a")).click();

    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.ReportITCase.java

License:Apache License

@Test
public void navigateAudit() {
    seleniumDriver.findElement(By.xpath("//img[@alt=\"Reports\"]")).click();
    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));

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

    wait.until(ExpectedConditions.presenceOfElementLocated(
            By.xpath("//option[contains(text(),'[REST]:[EntitlementLogic]:[]:[getOwn]:[SUCCESS]')]")));

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

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

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

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

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

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

From source file:org.apache.syncope.fit.console.reference.ResourceITCase.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[3]/div/a")).click();

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

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));

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

From source file:org.apache.syncope.fit.console.reference.ResourceITCase.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("//td[6]/div/span[13]/a")).click();

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

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));

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

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//tbody/tr[2]/td/input")));

    seleniumDriver.findElement(By.xpath("//tbody/tr[2]/td/input")).click();

    Alert alert = seleniumDriver.switchTo().alert();
    assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
    alert.accept();

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

    seleniumDriver.switchTo().defaultContent();
}

From source file:org.apache.syncope.fit.console.reference.ResourceITCase.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("//tr[3]/td[6]/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();//from   w  ww .j  a  v  a2  s  .co  m
}

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

License:Apache License

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

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

    seleniumDriver.findElement(By.xpath("//td[6]/div/span[13]/a")).click();

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

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));

    seleniumDriver.findElement(By.xpath("//li[4]/a")).click();

    assertTrue(seleniumDriver.findElements(By.xpath("//label[@for='passwordPolicy']")).size() > 0);

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

    seleniumDriver.switchTo().defaultContent();

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

From source file:org.apache.syncope.fit.console.reference.ResourceITCase.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/*from   ww  w.j a  v a2 s  . c  o  m*/
            .findElement(By.xpath(
                    "//*[@id=\"users-contain\"]//*[div=\"ws-target-resource-delete\"]/../td[6]/div/span[13]/a"))
            .click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
    seleniumDriver.switchTo().frame(0);

    wait.until(ExpectedConditions
            .presenceOfElementLocated(By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));

    seleniumDriver.findElement(By.xpath("//li[4]/a")).click();

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[text()='endpoint']")));

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

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

    seleniumDriver.switchTo().defaultContent();
}