List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOfElementLocated
public static ExpectedCondition<WebElement> visibilityOfElementLocated(final By locator)
From source file:org.apache.archiva.web.test.parent.AbstractSeleniumTest.java
License:Apache License
protected void assertUserLoggedIn(String username) { WebDriverWait wait = new WebDriverWait(getWebDriver(), 10); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("logout-link"))); Assert.assertFalse(isElementVisible("login-link")); Assert.assertFalse(isElementVisible("register-link")); Assert.assertFalse(isElementVisible("create-admin-link")); }
From source file:org.apache.archiva.web.test.RepositoryAdminTest.java
License:Apache License
@Test public void testManagedRepository() { // login( getAdminUsername(), getAdminPassword() ); WebDriverWait wait = new WebDriverWait(getWebDriver(), 20); WebElement el;/*from w ww.j a v a 2s . c o m*/ el = wait.until(ExpectedConditions.elementToBeClickable(By.id("menu-repositories-list-a"))); tryClick(el, ExpectedConditions.presenceOfElementLocated(By.id("managed-repositories-view-a")), "Managed Repositories not activated"); el = wait.until( ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#remote-repositories-content']"))); tryClick(el, ExpectedConditions.visibilityOfElementLocated( By.xpath("//table[@id='remote-repositories-table']//td[contains(text(),'central')]")), "Remote Repositories View not available"); el = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#remote-repository-edit']"))); el = tryClick(el, ExpectedConditions.visibilityOfElementLocated(By.id("remote-repository-save-button")), "Repository Save Button not available"); setFieldValue("id", "myrepoid"); setFieldValue("name", "My repo name"); setFieldValue("url", "http://www.repo.org"); el = wait.until(ExpectedConditions.elementToBeClickable(By.id("remote-repository-save-button"))); Actions actions = new Actions(getWebDriver()); actions.moveToElement(el); actions.perform(); ((JavascriptExecutor) getWebDriver()).executeScript("arguments[0].scrollIntoView();", el); el.click(); el = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("remote-repositories-view-a"))); ((JavascriptExecutor) getWebDriver()).executeScript("arguments[0].scrollIntoView();", el); tryClick(By.id("menu-proxy-connectors-list-a"), ExpectedConditions .visibilityOfElementLocated(By.id("proxy-connectors-view-tabs-a-network-proxies-grid")), "Network proxies not available", 3, 10); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("main-content"), "Proxy Connectors")); // proxy connect wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("proxy-connectors-view"), "central")); assertTextNotPresent("myrepoid"); el = wait.until(ExpectedConditions.elementToBeClickable(By.id("proxy-connectors-view-tabs-a-edit"))); el.click(); el = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("proxy-connector-btn-save"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("remote-repository-edit-fieldset"))); // Another hack, don't know why the normal selectValue() does not work here ((JavascriptExecutor) getWebDriver()).executeScript("jQuery('#sourceRepoId').css('display','block')"); Select select = new Select(getWebDriver().findElement(By.xpath(".//select[@id='sourceRepoId']"))); select.selectByVisibleText("internal"); // selectValue( "sourceRepoId", "internal", true ); // Workaround // TODO: Check after upgrade of htmlunit, bootstrap or jquery // TODO: Check whats wrong here ((JavascriptExecutor) getWebDriver()).executeScript("$('#targetRepoId').show();"); // End of Workaround wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("targetRepoId"))); selectValue("targetRepoId", "myrepoid"); el.click(); wait.until( ExpectedConditions.textToBePresentInElementLocated(By.id("user-messages"), "ProxyConnector added")); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("proxy-connectors-view"), "central")); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("proxy-connectors-view"), "myrepoid")); tryClick(By.xpath("//i[contains(@class,'icon-resize-vertical')]//ancestor::a"), ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("proxy-connector-edit-order-div")), "Edit order view not visible", 3, 10); // clickLinkWithXPath( "//i[contains(@class,'icon-resize-vertical')]//ancestor::a"); // This is needed here for HTMLUnit Tests. Currently do not know why, wait is not working for the // list entries down // waitPage(); // el = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("proxy-connector-edit-order-div"))); assertTextPresent("internal"); List<WebElement> repos = wait.until(ExpectedConditions .numberOfElementsToBe(By.xpath("//div[@id='proxy-connector-edit-order-div']/div"), 2)); Assert.assertTrue("First repo is myrepo", repos.get(0).getText().contains("myrepoid")); Assert.assertTrue("Second repo is central", repos.get(1).getText().contains("central")); // works until this point /*getSelenium().mouseDown( "xpath=//div[@id='proxy-connector-edit-order-div']/div[1]" ); getSelenium().mouseMove( "xpath=//div[@id='proxy-connector-edit-order-div']/div[2]" ); getSelenium().mouseUp( "xpath=//div[@id='proxy-connector-edit-order-div']/div[last()]" ); Assert.assertTrue( "Second repo is myrepo", getSelenium().getText("xpath=//div[@id='proxy-connector-edit-order-div']/div[2]" ).contains( "myrepoid" )); Assert.assertTrue( "First repo is central", getSelenium().getText("xpath=//div[@id='proxy-connector-edit-order-div']/div[1]" ).contains( "central" )); */ }
From source file:org.apache.syncope.fit.console.reference.ConfigurationITCase.java
License:Apache License
@Test public void editParameters() { seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']"))); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@title='Parameters']"))); seleniumDriver.findElement(By.xpath("//img[@title='Parameters']/ancestor::a")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0);//from w w w . ja va 2 s . co m seleniumDriver .findElement(By.xpath("//span[contains(text(), 'log.lastlogindate')]/../../div[2]/span/input")) .click(); 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 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);// w w w.ja v a 2 s . co m 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 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.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();/* w w w .ja v a 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 issueSYNCOPE506() { seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']"))); seleniumDriver.findElement(By.xpath("//tr[4]/td[3]/div/a/span")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0);//from www . j ava 2 s . c o m wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath("//select[@name='version:dropDownChoiceField']"))); 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/div/div[3]/div[2]/span/select"))); seleniumDriver.findElement(By.xpath( "//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/div[3]/span/div/div/span/a[2]/span/span")) .click(); seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input")).click(); seleniumDriver.switchTo().defaultContent(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback"))); assertTrue(seleniumDriver.findElement(By.tagName("body")).getText() .contains("Operation executed successfully")); seleniumDriver.findElement(By.xpath("//tr[4]/td[3]/div/a/span")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0); wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath("//select[@name='version:dropDownChoiceField']"))); 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/div/div[3]/div[2]/span/select"))); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@value='99']"))); 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 issueSyncope605() { 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[8]/td[7]/div/span[13]/a")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0);//from w ww . j a v a 2 s. c o m wait.until(ExpectedConditions .presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select"))); assertEquals("H2-testsync", seleniumDriver.findElement(By.xpath("//input[@name='displayName:textField']")) .getAttribute("value")); seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[3]/a")).click(); seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div[3]/span/input[7]")).click(); seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input")).click(); seleniumDriver.switchTo().defaultContent(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback"))); seleniumDriver.findElement(By.xpath("//tr[8]/td[7]/div/span[13]/a")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0); 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[3]/a")).click(); wait.until( ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div[3]/span/input[7]"))); assertFalse(seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div[3]/span/input[7]")).isSelected()); seleniumDriver.switchTo().defaultContent(); }
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.SchemaITCase.java
License:Apache License
@Test public void create() { seleniumDriver.findElement(By.xpath("//img[@alt=\"Schema\"]")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']"))); seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click(); seleniumDriver.findElement(By.xpath("//div[@id='gschema']/div/div/div/a")).click(); wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe"))); seleniumDriver.switchTo().frame(0);/*from w ww .j a v a 2 s. co m*/ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@name='key:textField']"))); Select select = new Select(seleniumDriver.findElement(By.name("type:dropDownChoiceField"))); select.selectByValue("0"); WebElement textField = seleniumDriver.findElement(By.name("key:textField")); textField.sendKeys("newschema"); seleniumDriver.findElement(By.name("apply")).click(); seleniumDriver.switchTo().defaultContent(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback"))); assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("newschema")); }