Search in sources :

Example 31 with WebDriver

use of org.openqa.selenium.WebDriver in project head by mifos.

the class MifosPackagedWARBasicTest method testPackagedWARStartup.

@Test
public void testPackagedWARStartup() throws Exception {
    WARServerLauncher serverLauncher = mifosLauncher(7077);
    serverLauncher.startServer();
    WebDriver wd = new FirefoxDriver();
    wd.get("http://localhost:7077/mifos/");
    wd.findElement(By.id("login.input.username")).sendKeys("mifos");
    wd.findElement(By.id("login.input.password")).sendKeys("testmifos");
    wd.findElement(By.id("login.button.login")).click();
    Assert.assertTrue(wd.getPageSource().contains("Mifos"));
    Assert.assertTrue(wd.getPageSource().contains("Home"));
    Assert.assertTrue(wd.getPageSource().contains("Search"));
    wd.quit();
    serverLauncher.stopServer();
    serverLauncher = null;
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WARServerLauncher(org.mifos.server.WARServerLauncher) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Test(org.junit.Test)

Example 32 with WebDriver

use of org.openqa.selenium.WebDriver 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 33 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class MultiSelect method getSelectLambda.

public Select getSelectLambda(Supplier<By> by) {
    Element element = untilFound(by);
    new WebDriverWait(this, 3, 100).until((WebDriver driver) -> {
        element.click();
        return !element.findElements(By.tagName("option")).isEmpty();
    });
    return new Select(element);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) WebElement(org.openqa.selenium.WebElement) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Select(org.openqa.selenium.support.ui.Select)

Example 34 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class MultiSelect method getSelect.

public Select getSelect(Supplier<By> by) {
    final Element element = untilFound(by);
    new WebDriverWait(this, 3, 100).until((Predicate<WebDriver>) driver -> {
        element.click();
        return !element.findElements(By.tagName("option")).isEmpty();
    });
    return new Select(element);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) NoSuchElementException(org.openqa.selenium.NoSuchElementException) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Arrays(java.util.Arrays) List(java.util.List) Predicate(com.google.common.base.Predicate) By(org.openqa.selenium.By) WebDriver(org.openqa.selenium.WebDriver) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement) Supplier(java.util.function.Supplier) Collectors(java.util.stream.Collectors) WebElement(org.openqa.selenium.WebElement) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Select(org.openqa.selenium.support.ui.Select)

Example 35 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class ActionBuildPerform method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/selectable.html");
    WebElement one = driver.findElement(By.name("one"));
    WebElement three = driver.findElement(By.name("three"));
    WebElement five = driver.findElement(By.name("five"));
    // Add all the actions into the Actions builder.
    Actions builder = new Actions(driver);
    builder.keyDown(Keys.CONTROL).click(one).click(three).click(five).keyUp(Keys.CONTROL);
    // Generate the composite action.
    Action compositeAction = builder.build();
    // Perform the composite action.
    compositeAction.perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Action(org.openqa.selenium.interactions.Action) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Aggregations

WebDriver (org.openqa.selenium.WebDriver)167 WebElement (org.openqa.selenium.WebElement)87 Test (org.junit.Test)61 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)59 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)40 Actions (org.openqa.selenium.interactions.Actions)25 IOException (java.io.IOException)12 Cookie (org.openqa.selenium.Cookie)11 List (java.util.List)10 File (java.io.File)9 HttpRequestCallback (ghostdriver.server.HttpRequestCallback)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)8 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)7 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)7 By (org.openqa.selenium.By)5 Dimension (org.openqa.selenium.Dimension)5 Predicate (com.google.common.base.Predicate)4 TimeoutException (org.openqa.selenium.TimeoutException)4