Example usage for org.openqa.selenium Keys ENTER

List of usage examples for org.openqa.selenium Keys ENTER

Introduction

In this page you can find the example usage for org.openqa.selenium Keys ENTER.

Prototype

Keys ENTER

To view the source code for org.openqa.selenium Keys ENTER.

Click Source Link

Usage

From source file:com.vaadin.tutorial.todomvc.TodoMvcIT.java

License:Apache License

private void editTodo(int row, String oldText, String newText) {
    verifyInlineEditorNotPresent();//w w w  . j  av a 2  s  .  c om
    verifyTodoText(row, oldText);

    Optional<WebElement> textCell = findElements(By.tagName("button")).stream()
            .filter(e -> e.getText().equals(oldText)).findAny();
    Assert.assertTrue(textCell.isPresent());
    textCell.get().click();

    Assert.assertEquals(oldText, getTodoTextInlineEditor().getValue());
    getTodoTextInlineEditor().clear();
    getTodoTextInlineEditor().sendKeys(newText);
    Assert.assertEquals(newText, getTodoTextInlineEditor().getValue());
    getTodoTextInlineEditor().sendKeys(Keys.ENTER);

    verifyInlineEditorNotPresent();
    verifyTodoText(row, newText);
}

From source file:com.vaadin.tutorial.todomvc.TodoMvcIT.java

License:Apache License

private void addTodo(String text) {
    getTodoField().sendKeys(text);
    verifyTodoFieldText(text);
    getTodoField().sendKeys(Keys.ENTER);
    verifyTodoFieldText("");
}

From source file:com.zaizi.automation.alfresco.core.pages.AdminConsolePage.java

License:Open Source License

/**
 * Change System Theme//from   w  w w  .j av  a2  s  . c o m
 * 
 * @param themeName
 *            : Name of the theme
 * @throws InterruptedException
 * @throws AWTException
 */

public void changeTheme(String themeName) throws InterruptedException, AWTException {
    NavigateToPage navigateToPage = new NavigateToPage(driver);
    navigateToPage.goToHome();
    Element.waitForLoad(driver);
    navigateToPage.goToAdminTools();
    Element.waitForLoad(driver);

    Actions action = new Actions(driver);

    Button themeDropDown = new Button(driver, By.xpath("//div//select[@id='console-options-theme-menu']"));
    themeDropDown.click();
    Thread.sleep(500);

    WebElement themeSelect = driver.findElement(By.xpath(
            "//div//select[@id='console-options-theme-menu']//option[contains(text(),'" + themeName + "')]"));

    action.click(themeSelect).sendKeys(Keys.ENTER).build().perform();
    Thread.sleep(1000);
    Element.waitForLoad(driver);
    Thread.sleep(1000);
    Button applyButton = new Button(driver,
            By.xpath("//div[@class='apply']//span//span//button[contains(text(),'Apply')]"));
    applyButton.click();
    Thread.sleep(1000);
    Element.waitForLoad(driver);
    Thread.sleep(500);
    navigateToPage.goToHome();
    Element.waitForLoad(driver);
}

From source file:contentspeed.CosCumparaturi.java

public void CompleteazaAdresa(String judet1, String oras1, String adresa1) {
    driver.findElement(judet).sendKeys(judet1);
    //driver.findElement(oras).isEnabled(); sometimes don't work
    driver.findElement(oras).sendKeys(Keys.ENTER);
    driver.findElement(oras).sendKeys(oras1);
    driver.findElement(adresa).sendKeys(adresa1);
}

From source file:contentspeed.ProdusCeai.java

public void CompleteazaAdresa(String judet1, String oras1, String adresa1) {
    driver.findElement(judet).sendKeys(judet1);
    driver.findElement(oras).isEnabled();
    //sometimes don't work
    // tb sa fac refresh la oras in functie de judet 
    driver.findElement(oras).sendKeys(Keys.ENTER);
    driver.findElement(oras).sendKeys(oras1);
    driver.findElement(adresa).sendKeys(adresa1);
}

From source file:de.codecentric.zucchini.web.steps.TypeStep.java

License:Apache License

/**
 * Types the keys./*from   w  w w.  ja  v a 2  s .  c o m*/
 */
@Override
public void go() {
    logger.info("Typing \"{}\"...", (Object) keys);
    new Actions(getWebDriver()).sendKeys(Keys.ENTER);
}

From source file:de.knowwe.uitest.BMIUITest.java

License:Open Source License

@Test
public void testBmi() throws Exception {
    changeArticleText(readFile("BMIUITest.txt"));

    By reset = By.className("reset");

    String currentStatus = UITestUtils.getCurrentStatus(getDriver());
    getDriver().findElement(reset).click();
    UITestUtils.awaitStatusChange(getDriver(), currentStatus);

    currentStatus = UITestUtils.getCurrentStatus(getDriver());
    getDriver().findElements(By.className("numinput")).get(0).sendKeys("2" + Keys.ENTER);
    UITestUtils.awaitStatusChange(getDriver(), currentStatus);

    currentStatus = UITestUtils.getCurrentStatus(getDriver());
    List<WebElement> numinput = getDriver().findElements(By.className("numinput"));
    numinput.get(1).sendKeys("100" + Keys.ENTER);
    UITestUtils.awaitStatusChange(getDriver(), currentStatus);

    assertEquals("25", getDriver().findElements(By.className("numinput")).get(2).getAttribute("value"));
    assertEquals("Normal weight", getDriver().findElement(By.className("SOLUTION-ESTABLISHED")).getText());
    assertEquals("bmi = 25", getDriver().findElement(By.className("ABSTRACTION")).getText());
}

From source file:de.knowwe.uitest.DiaFluxUITest.java

License:Open Source License

private void setValue(String value, int index) {
    String currentStatus = UITestUtils.getCurrentStatus(getDriver());
    getDriver().findElements(By.className("numinput")).get(index).sendKeys(value + Keys.ENTER);
    UITestUtils.awaitStatusChange(getDriver(), currentStatus);
}

From source file:de.knowwe.uitest.DiaFluxUITest.java

License:Open Source License

private void connect(WebElement source, int targetId, String... text) throws InterruptedException {
    source.click();/*  ww w .j  a  v a 2 s . co  m*/
    WebElement arrowTool = getDriver().findElement(By.className("ArrowTool"));
    WebElement targetNode = getDriver().findElement(By.id("#node_" + targetId));
    (new Actions(getDriver())).dragAndDrop(arrowTool, targetNode).perform();
    if (text.length > 0) {
        Select select = new Select(getDriver().findElement(By.cssSelector(".selectedRule select")));
        if (text[0].equalsIgnoreCase("formula")) {
            select.selectByIndex(10);
            getDriver().findElement(By.cssSelector(".selectedRule textarea")).sendKeys(text[1] + Keys.ENTER);
        } else {
            switch (text[0]) {
            case "[  ..  ]":
                select.selectByValue("8");
                break;
            case "[  ..  [":
                select.selectByValue("9");
                break;
            default:
                select.selectByVisibleText(text[0].trim());
                break;
            }
            if (text.length > 1) {
                List<WebElement> inputs = getDriver().findElements(By.cssSelector(".GuardEditor input"));
                inputs.get(0).sendKeys(text[1]);
                if (text.length > 2) {
                    inputs.get(1).sendKeys(text[2] + Keys.ENTER);
                } else {
                    inputs.get(0).sendKeys(Keys.ENTER);
                }
            }
        }
    }
}

From source file:de.knowwe.uitest.DiaFluxUITest.java

License:Open Source License

private void setNodeAttributes(By textSelector, String... text) throws InterruptedException {
    getDriver().findElement(textSelector).click();
    getDriver().findElement(textSelector).clear();
    getDriver().findElement(textSelector).sendKeys(text[0]);
    Thread.sleep(200);//from   w ww  . ja  v  a2s . c  om
    getDriver().findElement(textSelector).sendKeys(Keys.ENTER);
    if (text.length > 1) {
        Select actionSelect = new Select(getDriver().findElement(By.cssSelector(".ActionEditor select")));
        if (text[1].equalsIgnoreCase("formula")) {
            actionSelect.selectByIndex(1);
            //actionSelect.findElement(By.xpath("//option[@value='" + 1 + "']")).click();
            //actionSelect.findElements(By.tagName("option")).get(1).click();
            getDriver().findElement(By.cssSelector(".ActionEditor textarea")).sendKeys(text[2] + Keys.ENTER);
        } else if (text[1].startsWith("" + Keys.ARROW_DOWN)) {
            actionSelect.selectByIndex(text[1].length() - 1);
            //actionSelect.sendKeys(text[1] + Keys.ENTER);
        } else {
            actionSelect.selectByVisibleText(text[1]);
            //actionSelect.findElement(By.xpath("//option[text()='" + text[1] + "']")).click();
        }
    }

    List<WebElement> okButtons = getDriver().findElements(By.cssSelector(".NodeEditor .ok"));
    if (okButtons.size() == 1)
        okButtons.get(0).click();
}