List of usage examples for org.openqa.selenium.support.ui ExpectedConditions titleContains
public static ExpectedCondition<Boolean> titleContains(final String title)
From source file:com.pentaho.ctools.cdf.SchedulePrptComponent.java
License:Apache License
/** * This method will remove all created schedules on the tests. * Note - for a new schedule update code. *//*w w w . j a va 2 s . com*/ private void removeAllCreatedSchedules() { this.log.info("removeAllCreatedSchedules"); //Go to home page driver.get(PageUrl.PUC); // NOTE - we have to wait for loading disappear this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@class='busy-indicator-container waitPopup']")); //Click in Schedule wait.until(ExpectedConditions.titleContains("Pentaho User Console")); wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='pucUserDropDown']/table/tbody/tr/td/div"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//iframe[@id='home.perspective']"))); wait.until(ExpectedConditions .elementToBeClickable(By.xpath("//div[@id='mantle-perspective-switcher']/table/tbody/tr/td[2]"))); this.elemHelper .FindElement(driver, By.xpath("//div[@id='mantle-perspective-switcher']/table/tbody/tr/td[2]")) .click(); WebElement listMenyTr = this.elemHelper.FindElement(driver, By.xpath("//div[@id='customDropdownPopupMajor']/div/div/table/tbody")); List<WebElement> listMenuElementsTrs = listMenyTr.findElements(By.xpath("//td[@class='gwt-MenuItem']")); for (int i = 0; i < listMenuElementsTrs.size(); i++) { WebElement element = listMenuElementsTrs.get(i); if (element.getText().equals("Schedules")) { element.click(); break; } } wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div.workspaceHeading"))); // Now we are in Schedule page Boolean someThingToDelete = true; int listElements = 0; int listElementsPrevious = -1; while (someThingToDelete) { someThingToDelete = false; List<WebElement> listScheduleTrs = this.elemHelper .FindElement(driver, By.xpath("//table[@id='schedule-table']/tbody")) .findElements(By.tagName("tr")); listElements = listScheduleTrs.size(); //The new list must be different from previous list while (listElements == listElementsPrevious) { listScheduleTrs = this.elemHelper .FindElement(driver, By.xpath("//table[@id='schedule-table']/tbody")) .findElements(By.tagName("tr")); listElements = listScheduleTrs.size(); } for (int j = 1; j <= listElements; j++) { WebElement elementFirstDiv = this.elemHelper.FindElement(driver, By.xpath("//table[@id='schedule-table']/tbody/tr[" + j + "]/td/div")); if (elementFirstDiv.getText().equals(this.schNameTc3)) { elementFirstDiv.click(); //Select the row //Wait for row to be selected for (int t = 0; t < 100; t++) { WebElement elementRow = this.elemHelper.FindElement(driver, By.xpath("//table[@id='schedule-table']/tbody/tr[" + j + "]")); if (elementRow.getAttribute("class").contains("cellTableSelectedRow")) { break; } } //Click to remove the schedule item (the selected row) this.elemHelper.Click(driver, By.cssSelector("img.gwt-Image.pentaho-deletebutton")); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='pentaho-dialog']")); this.elemHelper.Click(driver, By.id("okButton")); this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@class='pentaho-dialog']")); someThingToDelete = true; //Continue checking if there is something to delete break; } } listElementsPrevious = listElements; } }
From source file:com.pentaho.ctools.cdf.TextInputComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:/*from w ww. ja v a 2 s .c om*/ * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("TextInputComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:com.pentaho.ctools.cdf.XactionComponent.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name://from w ww .j a v a 2s . c om * Reload Sample * Description: * Reload the sample (not refresh page). * Steps: * 1. Click in Code and then click in button 'Try me'. */ @Test public void tc1_PageContent_DisplayTitle() { // Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); // Wait for visibility of 'VisualizationAPIComponent' wait.until(ExpectedConditions .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("XactionComponent", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]"))); }
From source file:common.KeywordBase.java
License:Apache License
/** * Wait until title is displayed//from w w w. j ava 2 s . c om * * @param title * Title of the page. */ public synchronized void waitForElementByTitle(String title) { wait.until(ExpectedConditions.titleContains(getString(title))); }
From source file:net.atf4j.webdriver.page.AbstractPageObject.java
License:Open Source License
/** * Wait until title contains partial text. * * @param pageTitle the partial page title * @return true if within timeout, otherwise false. *///from www. j a v a 2s . co m public Boolean waitUntilTitleContains(final String pageTitle) { return this.webDriverWait.until(ExpectedConditions.titleContains(pageTitle)); }
From source file:org.apache.archiva.web.test.ArchivaAdminTest.java
License:Apache License
@Test public void testHome() { loadPage(baseUrl, 30);/* w ww. j av a2 s . c o m*/ WebDriverWait wait = new WebDriverWait(getWebDriver(), 30); wait.until(ExpectedConditions.titleContains("Apache Archiva")); }
From source file:org.mrge.tradeo.seleniumtask.traderpopup.HomePageTest.java
@Test public void signInAsCustomerFromHomePage() throws Exception { gotoHomePageAndSignIn(TradeoTestCustomer.loginCorrectPassword); WebDriverWait wait = new WebDriverWait(driver, WAIT_AFTER_CLICK_IN_SEC); wait.until(ExpectedConditions.titleContains(TradeoMyAccountPage.title)); WebElement usernameLink = driver.findElement(By.xpath(TradeoHomePage.usernameXpath)); assertEquals(TradeoTestCustomer.usernameTextEnglish, usernameLink.getText()); }
From source file:org.mycore.mir.it.tests.MIRAdminEditorITCase.java
@Test /**/*from ww w.j a v a2 s . c o m*/ * FIXME: put all search methods in extra test cases and find a ways to run methods in a defined order */ public void searchByTitle() { simpleSearchController.simpleSearchBy(MIRTestData.TITLE, null, null, null, null); final ExpectedCondition<Boolean> condition = ExpectedConditions.titleContains("Suchergebnisse"); driver.waitFor(condition); String noDocumentsFoundText = "Keine Dokumente gefunden"; WebDriverWait wait = new WebDriverWait(driver, 30); wait.until((driver) -> { try { driver.findElement(MCRBy.partialText(noDocumentsFoundText)); return false; } catch (NoSuchElementException e) { return true; } }); }
From source file:org.mycore.mir.it.tests.MIRComplexSearchITCase.java
@Test public final void searchByNone() { searchController.complexSearchBy(Collections.emptyList(), null, null, null, null, null, null, null, null); driver.waitFor(ExpectedConditions.titleContains("Suchergebnisse")); try {/*from www. j a v a 2s .co m*/ String noDocumentsFoundText = "Keine Dokumente gefunden"; driver.findElement(MCRBy.partialText(noDocumentsFoundText)); Assert.fail(noDocumentsFoundText + " is present!"); } catch (NoSuchElementException e) { // this is good } }
From source file:org.mycore.mir.it.tests.MIRComplexSearchITCase.java
@Test public final void searchByIdentifier() { searchController.complexSearchBy(Collections.emptyList(), "10.1000/182", null, null, null, null, null, null, null);/* w w w.j a v a2 s . co m*/ driver.waitFor(ExpectedConditions.titleContains("Suchergebnisse")); try { String noDocumentsFoundText = "Keine Dokumente gefunden"; driver.findElement(MCRBy.partialText(noDocumentsFoundText)); Assert.fail(noDocumentsFoundText + " is present!"); } catch (NoSuchElementException e) { // this is good } }