List of usage examples for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElementLocated
public static ExpectedCondition<Boolean> textToBePresentInElementLocated(final By locator, final String text)
From source file:com.vmware.gemfire.tools.pulse.tests.PulseBaseTest.java
License:Apache License
public void verifyTextPresrntById(String id, String text) { WebDriverWait wait = new WebDriverWait(driver, maxWaitTime, 500); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id(id), text)); }
From source file:com.vmware.gemfire.tools.pulse.tests.PulseBaseTest.java
License:Apache License
public void verifyTextPresrntByXpath(String xpath, String text) { WebDriverWait wait = new WebDriverWait(driver, maxWaitTime, 500); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.xpath(xpath), text)); }
From source file:evaluation.OctaneExperimentRunner.java
License:Apache License
public void testBenchmark(String benchmark) throws Exception { driver.get(baseUrl + "index_" + benchmark + ".html?auto=1"); (new WebDriverWait(driver, maxWaitTime)) .until(ExpectedConditions.textToBePresentInElementLocated(By.id("main-banner"), "Score")); System.out.println("Ending execution..."); JavascriptExecutor jse = (JavascriptExecutor) driver; try {// w ww. j a v a 2 s.c o m jse.executeScript(endExecCode, ""); } catch (Exception ex) { System.out.println("!!!exception occurred, analysis.json file is not generated."); System.out.println(ex); } System.out.println("Will sleep a bit.."); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:io.federecio.dropwizard.swagger.selenium.DefaultServerWithAssetsSeleniumTest.java
License:Apache License
@Test public void testApplicationAssetsAreAccessible() throws Exception { driver.get(BASE_URL + "/test.html"); driver.manage().timeouts().implicitlyWait(WAIT_IN_SECONDS, TimeUnit.SECONDS); By xpath = By.xpath("//h1"); new WebDriverWait(driver, WAIT_IN_SECONDS) .until(ExpectedConditions.textToBePresentInElementLocated(xpath, "test asset")); }
From source file:io.federecio.dropwizard.swagger.selenium.SeleniumTest.java
License:Apache License
private void assertResponseCodeIs200() { By xpath = By.xpath("//div[@class='block response_code']/pre"); new WebDriverWait(driver, WAIT_IN_SECONDS) .until(ExpectedConditions.textToBePresentInElementLocated(xpath, "200")); }
From source file:io.github.bonigarcia.wdm.base.BaseBrowserTst.java
License:Open Source License
@Test public void test() { if (validOS) { WebDriverWait wait = new WebDriverWait(driver, TIMEOUT); driver.get("https://en.wikipedia.org/wiki/Main_Page"); By searchInput = By.id("searchInput"); wait.until(ExpectedConditions.presenceOfElementLocated(searchInput)); driver.findElement(searchInput).sendKeys("Software"); By searchButton = By.id("searchButton"); wait.until(ExpectedConditions.elementToBeClickable(searchButton)); driver.findElement(searchButton).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), "Computer software")); }//ww w .j av a 2 s .c o m }
From source file:io.github.bonigarcia.wdm.test.ChromeTest.java
License:Apache License
@Test public void test() { // Your test code here. For example: WebDriverWait wait = new WebDriverWait(driver, 30); // 30 seconds of timeout driver.get("https://en.wikipedia.org/wiki/Main_Page"); // navigate to Wikipedia By searchInput = By.id("searchInput"); // search for "Software" wait.until(ExpectedConditions.presenceOfElementLocated(searchInput)); driver.findElement(searchInput).sendKeys("Software"); By searchButton = By.id("searchButton"); wait.until(ExpectedConditions.elementToBeClickable(searchButton)); driver.findElement(searchButton).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), "Computer software")); // assert that the resulting page contains a text }
From source file:io.github.bonigarcia.wdm.test.ManagerTest.java
License:Open Source License
public void browseWikipedia() { WebDriverWait wait = new WebDriverWait(driver, TIMEOUT); driver.get("http://en.wikipedia.org/wiki/Main_Page"); By searchInput = By.id("searchInput"); wait.until(ExpectedConditions.presenceOfElementLocated(searchInput)); driver.findElement(searchInput).sendKeys("Software"); By searchButton = By.id("searchButton"); wait.until(ExpectedConditions.elementToBeClickable(searchButton)); driver.findElement(searchButton).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), "Computer software or simply software")); }
From source file:io.github.bonigarcia.wdm.test.PerformanceChromeTest.java
License:Apache License
private void singleTestExcution(WebDriver driver) { WebDriverWait wait = new WebDriverWait(driver, 30); // 30 seconds of timeout driver.get("https://en.wikipedia.org/wiki/Main_Page"); // navigate to Wikipedia By searchInput = By.id("searchInput"); // search for "Software" wait.until(ExpectedConditions.presenceOfElementLocated(searchInput)); driver.findElement(searchInput).sendKeys("Software"); By searchButton = By.id("searchButton"); wait.until(ExpectedConditions.elementToBeClickable(searchButton)); driver.findElement(searchButton).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), "Computer software")); // assert that the resulting page contains a text }
From source file:io.github.bonigarcia.wdm.test.PerformancePhantomJsTest.java
License:Apache License
private void singleTestExcution(WebDriver driver) { WebDriverWait wait = new WebDriverWait(driver, 30); // 30 seconds of timeout driver.get("https://en.wikipedia.org/wiki/Main_Page"); // navigate to Wikipedia By searchInput = By.id("searchInput"); // search for "Software" wait.until(ExpectedConditions.presenceOfElementLocated(searchInput)); driver.findElement(searchInput).sendKeys("Software"); By searchButton = By.id("searchButton"); wait.until(ExpectedConditions.elementToBeClickable(searchButton)); driver.findElement(searchButton).click(); wait.until(ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), "Computer software")); // assert that the resulting page contains a text }