Search in sources :

Example 21 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project geode by apache.

the class PulseTestUtils method verifyElementPresentByXpath.

public static void verifyElementPresentByXpath(String xpath) {
    WebDriverWait wait = new WebDriverWait(getDriver(), maxWaitTime, 500);
    wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(xpath)));
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 22 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.

the class ConsoleTestUtils method waitForConsoleContainsText.

public static void waitForConsoleContainsText(WebDriver driver, final String text) {
    final WebElement output = driver.findElement(By.id(ElementIds.getElementId(ElementIds.CONSOLE_OUTPUT)));
    (new WebDriverWait(driver, 5)).until(new ExpectedCondition<Boolean>() {

        public Boolean apply(WebDriver d) {
            String outputText = output.getText();
            return outputText.contains(text);
        }
    });
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Example 23 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.

the class DialogTestUtils method respondToModalDialog.

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();
            break;
        }
    }
    (new WebDriverWait(driver, 5)).until(ExpectedConditions.stalenessOf(dialog));
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Example 24 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.

the class RConsoleInteraction method testPlotGeneration.

@Test
public void testPlotGeneration() {
    ConsoleTestUtils.resumeConsoleInteraction(driver_);
    Actions plotCars = new Actions(driver_);
    plotCars.sendKeys(Keys.ESCAPE + "plot(cars)" + Keys.ENTER);
    plotCars.perform();
    // Wait for the Plot window to activate
    final WebElement plotWindow = (new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.PLOT_IMAGE_FRAME))));
    // Wait for a plot to appear in the window
    Assert.assertEquals(plotWindow.getTagName(), "iframe");
    driver_.switchTo().frame(plotWindow);
    (new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.tagName("img")));
    // Switch back to document context
    driver_.switchTo().defaultContent();
}
Also used : Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 25 with WebDriverWait

use of org.openqa.selenium.support.ui.WebDriverWait in project rstudio by rstudio.

the class RConsoleInteraction method testInvokeHelp.

@Test
public void testInvokeHelp() {
    ConsoleTestUtils.resumeConsoleInteraction(driver_);
    Actions help = new Actions(driver_);
    help.sendKeys(Keys.ESCAPE + "?lapply" + Keys.ENTER);
    help.perform();
    // Wait for the Help window to activate
    final WebElement helpWindow = (new WebDriverWait(driver_, 5)).until(ExpectedConditions.presenceOfElementLocated(By.id(ElementIds.getElementId(ElementIds.HELP_FRAME))));
    // Wait for help to appear in the window
    Assert.assertEquals(helpWindow.getTagName(), "iframe");
    driver_.switchTo().frame(helpWindow);
    (new WebDriverWait(driver_, 5)).until(ExpectedConditions.textToBePresentInElement(By.tagName("body"), "lapply"));
    // Switch back to document context
    driver_.switchTo().defaultContent();
}
Also used : Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Aggregations

WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)556 WebElement (org.openqa.selenium.WebElement)173 WebDriver (org.openqa.selenium.WebDriver)139 Test (org.junit.Test)88 By (org.openqa.selenium.By)58 Actions (org.openqa.selenium.interactions.Actions)54 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)47 TimeoutException (org.openqa.selenium.TimeoutException)41 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)38 IOException (java.io.IOException)30 List (java.util.List)27 Wait (org.openqa.selenium.support.ui.Wait)25 BeforeClass (org.junit.BeforeClass)24 NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)21 ArrayList (java.util.ArrayList)21 WebDriverException (org.openqa.selenium.WebDriverException)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)21 Dimension (org.openqa.selenium.Dimension)20 File (java.io.File)18 NoSuchElementException (org.openqa.selenium.NoSuchElementException)16