List of usage examples for org.openqa.selenium.support.ui ExpectedConditions stalenessOf
public static ExpectedCondition<Boolean> stalenessOf(final WebElement element)
From source file:org.alfresco.po.PageElement.java
License:Open Source License
/** * Wait Until element successfully deleting from DOM. * //from w w w .j a v a2s. co m * @param locator - CSS Locator * @param timeOutInSeconds - Timeout In Seconds */ public void waitUntilElementDeletedFromDom(By locator, long timeOutInSeconds) { WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds); try { wait.until(ExpectedConditions.stalenessOf(driver.findElement(locator))); } catch (NoSuchElementException e) { /* if element already not in DOM! */} }
From source file:org.apache.falcon.regression.ui.search.PageHeader.java
License:Apache License
/** * Check header and make sure all the buttons/links are working correctly. Handles both * logged in and logged out scenarios./* w w w. j av a2 s . co m*/ */ public void checkHeader() { //home button is always displayed UIAssert.assertDisplayed(homeButton, "falcon logo"); Assert.assertEquals(homeButton.getText(), "Falcon", "Unexpected home button text"); UIAssert.assertDisplayed(falconLogo, "falcon logo"); final WebElement helpLink = loginHeaderBox.findElement(By.tagName("a")); UIAssert.assertDisplayed(helpLink, "help link"); final String oldUrl = driver.getCurrentUrl(); //displayed if user is logged in: create entity buttons, upload entity button, username if (MerlinConstants.IS_SECURE || getLogoutButton().isDisplayed()) { //checking create entity box UIAssert.assertDisplayed(createEntityBox, "Create entity box"); final WebElement createEntityLabel = createEntityBox.findElement(By.tagName("h4")); Assert.assertEquals(createEntityLabel.getText(), "Create an entity", "Unexpected create entity text"); //checking upload entity part UIAssert.assertDisplayed(uploadEntityBox, "Create entity box"); final WebElement uploadEntityLabel = uploadEntityBox.findElement(By.tagName("h4")); Assert.assertEquals(uploadEntityLabel.getText(), "Upload an entity", "Unexpected upload entity text"); Assert.assertEquals(uploadEntityButton.getText(), "Browse for the XML file", "Unexpected text on upload entity button"); //checking if logged-in username is displayed if (!MerlinConstants.IS_SECURE) { UIAssert.assertDisplayed(getLogoutButton(), "Logout button"); AssertUtil.assertNotEmpty(getLoggedInUser(), "Expecting logged-in username."); } //create button navigation doCreateCluster(); driver.get(oldUrl); doCreateFeed(); driver.get(oldUrl); doCreateProcess(); driver.get(oldUrl); driver.get(oldUrl); } //home button navigation homeButton.click(); Assert.assertTrue(getHomeUrls().contains(driver.getCurrentUrl()), "home button navigate to: " + driver.getCurrentUrl() + " instead of: " + getHomeUrls()); driver.get(oldUrl); //help link navigation Assert.assertEquals(helpLink.getText(), "Help", "Help link expected to have text 'Help'"); clickLink(helpLink); int helpPageloadTimeoutThreshold = 30; new WebDriverWait(driver, helpPageloadTimeoutThreshold).until(ExpectedConditions.stalenessOf(helpLink)); Assert.assertEquals(driver.getCurrentUrl(), MerlinConstants.HELP_URL, "Unexpected help url"); driver.get(oldUrl); }
From source file:org.glowroot.agent.webdriver.tests.config.InstrumentationConfigPage.java
License:Apache License
public void clickAddButton() { WebElement addButton = withWait(xpath("//button[normalize-space()='Add']")); addButton.click();//w w w. j ava 2 s . c o m // wait for add to complete new WebDriverWait(driver, 30).until(ExpectedConditions.stalenessOf(addButton)); }
From source file:org.glowroot.agent.webdriver.tests.InstrumentationConfigIT.java
License:Apache License
@Test public void shouldNotValidateOnDeleteInstrumentation() throws Exception { // given/*from ww w . j a v a 2 s . c o m*/ App app = new App(driver, "http://localhost:" + getUiPort()); GlobalNavbar globalNavbar = new GlobalNavbar(driver); ConfigSidebar configSidebar = new ConfigSidebar(driver); app.open(); globalNavbar.getConfigurationLink().click(); configSidebar.getInstrumentationLink().click(); createTransactionInstrumentation(); app.open(); globalNavbar.getConfigurationLink().click(); configSidebar.getInstrumentationLink().click(); Utils.withWait(driver, partialLinkText("org.glowroot.agent.it.harness.Container")).click(); InstrumentationConfigPage configPage = new InstrumentationConfigPage(driver); WebElement classNameTextField = configPage.getClassNameTextField(); // when Utils.clearInput(configPage.getTimerNameTextField()); configPage.getDeleteButton().click(); // then new WebDriverWait(driver, 30).until(ExpectedConditions.stalenessOf(classNameTextField)); }
From source file:org.glowroot.tests.InstrumentationConfigIT.java
License:Apache License
@Test public void shouldNotValidateOnDeleteInstrumentation() throws Exception { // given/*from w w w . j a v a 2s. c o m*/ App app = app(); GlobalNavbar globalNavbar = globalNavbar(); ConfigSidebar configSidebar = new ConfigSidebar(driver); app.open(); globalNavbar.getConfigLink().click(); configSidebar.getInstrumentationLink().click(); createTransactionInstrumentation(); app.open(); globalNavbar.getConfigLink().click(); configSidebar.getInstrumentationLink().click(); Utils.withWait(driver, partialLinkText("org.glowroot.agent.it.harness.Container")).click(); InstrumentationConfigPage configPage = new InstrumentationConfigPage(driver); WebElement classNameTextField = configPage.getClassNameTextField(); // when Utils.clearInput(configPage.getTimerNameTextField()); configPage.getDeleteButton().click(); // then new WebDriverWait(driver, 30).until(ExpectedConditions.stalenessOf(classNameTextField)); }
From source file:org.glowroot.tests.webdriver.InstrumentationConfigTest.java
License:Apache License
@Test public void shouldNotValidateOnDeleteInstrumentation() throws Exception { // given/*from ww w . j av a 2 s . c om*/ App app = new App(driver, "http://localhost:" + container.getUiPort()); GlobalNavbar globalNavbar = new GlobalNavbar(driver); ConfigSidebar configSidebar = new ConfigSidebar(driver); app.open(); globalNavbar.getConfigurationLink().click(); configSidebar.getInstrumentationLink().click(); createTransactionInstrumentation(); app.open(); globalNavbar.getConfigurationLink().click(); configSidebar.getInstrumentationLink().click(); Utils.withWait(driver, partialLinkText("org.glowroot.container.Container")).click(); InstrumentationConfigPage configPage = new InstrumentationConfigPage(driver); WebElement classNameTextField = configPage.getClassNameTextField(); // when Utils.clearInput(configPage.getTimerNameTextField()); configPage.getDeleteButton().click(); // then new WebDriverWait(driver, 30).until(ExpectedConditions.stalenessOf(classNameTextField)); }
From source file:org.labkey.test.components.trialshare.StudySummaryWindow.java
License:Apache License
public void closeWindow() { // There is a small region at the edges of the window that the user can click to resize the window. // This region overlaps with the default position too click on the close button. _test.clickAt(elements().closeButton.findElement(_window), 0, 13, 0); _test.shortWait().until(ExpectedConditions.stalenessOf(_window)); }
From source file:org.labkey.test.pages.trialshare.StudyEditPage.java
License:Apache License
public void removeStudyAccessPanel(int panelIndex) { WebElement studyAccessPanelRemoveBtn = elementCache().getStudyAccessPanelRemoveBtn(panelIndex); studyAccessPanelRemoveBtn.click();/* www. jav a 2 s. c o m*/ shortWait().until(ExpectedConditions.stalenessOf(studyAccessPanelRemoveBtn)); }
From source file:org.labkey.test.tests.trialshare.TrialShareDataFinderTest.java
License:Apache License
private void testSearchTerm(DataFinderPage finder, DataFinderPage.Dimension dimension, String field, String term, int expectedCount) { List<DataFinderPage.DataCard> dataCards = finder.getDataCards(); finder.search(term);//from w w w . j a v a 2s .com if (expectedCount > 0) shortWait().until(ExpectedConditions.stalenessOf(dataCards.get(0).getCardElement())); if (!StringUtils.isEmpty(term)) { assertTrue("Clear All should be active after entering search term", finder.clearAllActive()); } dataCards = finder.getDataCards(); assertEquals("Wrong number of cards after search for '" + term + "' (" + field + ")", expectedCount, dataCards.size()); assertCountsSynced(finder, dimension); }
From source file:org.rstudio.studio.selenium.DialogTestUtils.java
License:Open Source License
public static void respondToModalDialog(WebDriver driver, String response) { WebElement dialog = waitForModalToAppear(driver); // Find the button requested and invoke it List<WebElement> buttons = dialog.findElements(By.className("gwt-Button-DialogAction")); for (WebElement button : buttons) { if (button.getText().equals(response)) { button.click();/* ww w. ja v a2s. c o m*/ break; } } (new WebDriverWait(driver, 5)).until(ExpectedConditions.stalenessOf(dialog)); }