List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOf
public static ExpectedCondition<WebElement> visibilityOf(final WebElement element)
From source file:com.sugarcrm.candybean.automation.control.Pause.java
License:Open Source License
public VControl untilVisible(int timeout_ms) throws Exception { (new WebDriverWait(this.c.iface.wd, timeout_ms)).until(ExpectedConditions.visibilityOf(this.c.we)); return this.c; }
From source file:com.sugarcrm.candybean.automation.webdriver.WebDriverPause.java
License:Open Source License
@Override public WebDriverElement untilVisible(int timeoutMs) { (new WebDriverWait(this.wde.wd, timeoutMs / 1000)).until(ExpectedConditions.visibilityOf(this.wde.we)); return this.wde; }
From source file:com.technophobia.webdriver.substeps.impl.ActionWebDriverSubStepImplementations.java
License:Open Source License
/** * Asserts that the current element is visible, it will wait until this is true * @example AssertCurrentElement is visible * @section Assertions// w ww .j a va 2 s. c om */ @Step("AssertCurrentElement is visible") public void assertCurrentElementIsVisible() { WebElement currentElement = webDriverContext().getCurrentElement(); waitUntil(ExpectedConditions.visibilityOf(currentElement)); }
From source file:com.testmax.handler.ElementHandler.java
License:CDDL license
public WebElement waitForElement(WebElement elementToWaitFor, Integer waitTimeInMili) { WebElement elm = null;/*ww w .ja va2 s . c om*/ WebDriverWait wait = null; if (waitTimeInMili == null) { waitTimeInMili = 10000; } try { this.setImpilicitTimeInMiliSec(new Integer(waitTimeInMili)); wait = new WebDriverWait(this.getDriver(), waitTimeInMili / 1000); elm = wait.until(ExpectedConditions.visibilityOf(elementToWaitFor)); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TestMaxException e) { // TODO Auto-generated catch block //wait = new WebDriverWait(this.getDriver(), waitTimeInMili/1000); // elm= wait.until(ExpectedConditions.); } catch (Exception e) { // TODO Auto-generated catch block //wait = new WebDriverWait(this.getDriver(), waitTimeInMili/1000); // elm= wait.until(ExpectedConditions.presenceOfElementLocated(by)); } return elm; }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseAbstractTest.java
License:Apache License
@Ignore("WIP") @Test/*www.ja va 2s .co m*/ public void testDataBrowser() { driver.findElement(By.linkText("Data Browser")).click(); // WebElement dataBrowserLabel = driver.findElement(By.xpath("")); WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//label[text()='Data Browser']")))); // Verify all elements must be displayed on data browser screen assertTrue(driver.findElement(By.xpath("//a[text()='Data Regions']")).isDisplayed()); assertTrue(driver.findElement(By.id("linkColocatedRegions")).isDisplayed()); assertTrue(driver.findElement(By.linkText("All Regions")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//a[text()='Region Members']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//a[text()='Queries']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//label[text()='Query Editor']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//label[text()='Result']")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//input[@value='Export Result']")).isDisplayed()); assertTrue(driver.findElement(By.id("btnExecuteQuery")).isDisplayed()); assertTrue(driver.findElement(By.xpath("//input[@value='Clear']")).isDisplayed()); assertTrue(driver.findElement(By.id("dataBrowserQueryText")).isDisplayed()); assertTrue(driver.findElement(By.id("historyIcon")).isDisplayed()); //Actual query execution driver.findElement(By.id("dataBrowserQueryText")).sendKeys("Query1"); // Assert data regions are displayed assertTrue(driver.findElement(By.id("treeDemo_1")).isDisplayed()); }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseTest.java
License:Apache License
@Ignore("WIP") @Test/*from ww w . j av a 2s .c o m*/ public void testDataBrowser() { driver.findElement(By.linkText("Data Browser")).click(); // WebElement dataBrowserLabel = driver.findElement(By.xpath("")); WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//label[text()='Data Browser']")))); // Verify all elements must be displayed on data browser screen Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Data Regions']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("linkColocatedRegions")).isDisplayed()); Assert.assertTrue(driver.findElement(By.linkText("All Regions")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Region Members']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//a[text()='Queries']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//label[text()='Query Editor']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//label[text()='Result']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//input[@value='Export Result']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("btnExecuteQuery")).isDisplayed()); Assert.assertTrue(driver.findElement(By.xpath("//input[@value='Clear']")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("dataBrowserQueryText")).isDisplayed()); Assert.assertTrue(driver.findElement(By.id("historyIcon")).isDisplayed()); //Actual query execution driver.findElement(By.id("dataBrowserQueryText")).sendKeys("Query1"); // Assert data regions are displayed Assert.assertTrue(driver.findElement(By.id("treeDemo_1")).isDisplayed()); }
From source file:dagaz.controllers.ChildController.java
public void placeBet() throws ArenaNotAvailable { if (isActive) { if (!isReady()) { WebDriverWait wait = new WebDriverWait(driver, 10); try { WebElement btnArena = wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath( "//div[@class='maincontent']/div[@class='leftcol']/div[@class='arena-ctn cf']/a[text()='" + arena + "']")))); btnArena.click();/* w ww. j av a 2 s . c o m*/ } catch (Exception ex) { throw new ArenaNotAvailable(arena); } } if (driver.findElements(By.xpath("//span[@class='ui-dialog-title']")).size() > 0) { closeDialog(); } if (hasMatch()) { if ((match == null) || (match.getMatchNumber() != Integer .parseInt(driver.findElement(By.id("match-number")).getText()))) { if (match != null) { getResult(match.getMatchNumber()); } else { this.homeWin = Integer.parseInt(driver.findElement(By.id("banker-win")).getText()); this.awayWin = Integer.parseInt(driver.findElement(By.id("player-win")).getText()); this.drawWin = Integer.parseInt(driver.findElement(By.id("win-win")).getText()); } match = new MatchState(driver); } match.updateState(); if (match.isLastState() && !match.isIsPlaced()) { if (driver.findElements(By.xpath("//table[@id='accepted_bet']//tr")).size() < 2) { try { if (!isConnectionReady()) { switchChannel(); } betNow(); } catch (Exception e) { config.getRoot().appendDetails("[ERROR]\n\t[" + arena + "] Failed to place bet."); } } if (!match.isLastState() && match.isStateChanged() && !match.isIsPlaced()) { config.getRoot().appendDetails("- [" + arena + "] - [" + match.getMatchNumber() + "] Missssssssss..................."); } } } else { if (!isWaitForMatch && !isAlreadyNotice) { config.getRoot().appendDetails("[" + arena + "] No matches available."); isAlreadyNotice = true; } } } }
From source file:dagaz.controllers.SingleThread.java
private ArrayList<String> getAvailableArenas() { ArrayList<String> arenas = new ArrayList<String>(); WebDriverWait wait = new WebDriverWait(driver, 20); try {/*from w w w . j av a2 s. c o m*/ WebElement btnArena = wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath( "//div[@class='maincontent']/div[@class='leftcol']/div[@class='arena-ctn cf']/a[@class='arena-ctn-itm left active']")))); } catch (Exception ex) { Logger.getLogger(SingleThread.class.getName()).log(Level.SEVERE, null, ex); } List<WebElement> list = driver.findElements( By.xpath("//div[@class='maincontent']/div[@class='leftcol']/div[@class='arena-ctn cf']/a")); for (WebElement arena : list) { if (arena.isDisplayed()) { arenas.add(arena.getText()); } } return arenas; }
From source file:dk.dma.ais.abnormal.web.EventsIT.java
License:Open Source License
@Test public void canDisplayEventsViaTicker() throws InterruptedException { try {// w w w . j a v a 2 s .co m // Assert there are 5 events in the ticker List<WebElement> tickerElements = browser.findElements(cssSelector("#ticker li")); assertEquals(5, tickerElements.size()); // Assert that the ticker rolls between events WebElement ticker0Element = tickerElements.get(0); WebElement ticker1Element = tickerElements.get(1); System.out.println("ticker0=" + ticker0Element.getText()); wait.until(ExpectedConditions.visibilityOf(ticker0Element)); System.out.println("ticker0=" + ticker0Element.getText()); assertTrue(ticker0Element.getText().matches(".*TYCHO BRAHE.*")); System.out.println("ticker1=" + ticker1Element.getText()); wait.until(ExpectedConditions.visibilityOf(ticker1Element)); System.out.println("ticker1=" + ticker1Element.getText()); assertTrue(ticker1Element.getText().matches(".*SILVERTARNAN.*")); // Assert that event in ticker can be clicked ticker1Element.findElement(cssSelector("span.glyphicon")).click(); } catch (AssertionError e) { IntegrationTestHelper.takeScreenshot(browser, "error"); throw e; } catch (WebDriverException e) { IntegrationTestHelper.takeScreenshot(browser, "error"); throw e; } }
From source file:jhc.redsniff.webdriver.ExtraExpectedConditions.java
License:Apache License
/** * An expectation for checking that an element, known to be present on the DOM * of a page, is visible. Visibility means that the element is not only * displayed but also has a height and width that is greater than 0. * * @param element the WebElement//w w w .jav a 2 s. co m * @return the (same) WebElement once it is visible */ public static ExpectedCondition<WebElement> visibilityOf(final WebElement element) { return new ExpectedCondition<WebElement>() { public String toString() { return "visibility of " + asString(element); } @Override public WebElement apply(WebDriver input) { return ExpectedConditions.visibilityOf(element).apply(input); } }; }