Example usage for org.openqa.selenium Keys TAB

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

Introduction

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

Prototype

Keys TAB

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

Click Source Link

Usage

From source file:com.vaadin.demo.registration.RegistrationFormIT.java

License:Apache License

@Test
public void validateConfirmPasswd_invalid() {
    PasswordFieldElement password = $(PasswordFieldElement.class).get(0);
    password.sendKeys("aa11bbss33ddd");
    password.sendKeys(Keys.TAB);

    password = $(PasswordFieldElement.class).get(1);
    password.sendKeys("a");
    password.sendKeys(Keys.TAB);/*  w  w  w  .j a  va2  s.c  o m*/

    assertStatusMessagePresent("Password doesn't match");
    List<WebElement> icons = findElements(By.className("v-icon"));
    Assert.assertEquals(VALID_ICON_CHAR, icons.get(0).getText().charAt(0));
    Assert.assertEquals(INVALID_ICON_CHAR, icons.get(1).getText().charAt(0));
}

From source file:com.vaadin.demo.registration.RegistrationFormIT.java

License:Apache License

@Test
public void validateConfirmPasswd_empty() {
    PasswordFieldElement password = $(PasswordFieldElement.class).get(0);
    password.sendKeys("aa11bbss33ddd");
    password.sendKeys(Keys.TAB);

    password = $(PasswordFieldElement.class).get(1);
    password.sendKeys(Keys.DELETE);//from w w  w .jav a  2s .c om
    password.sendKeys(Keys.TAB);

    Assert.assertEquals(1, findElements(By.className("validation-message")).size());
    List<WebElement> icons = findElements(By.className("v-icon"));
    Assert.assertEquals(VALID_ICON_CHAR, icons.get(0).getText().charAt(0));
}

From source file:com.vaadin.demo.registration.RegistrationFormIT.java

License:Apache License

@Test
public void noCrossValidationOnNameField() {
    TextFieldElement nameField = $(TextFieldElement.class).get(0);
    nameField.sendKeys("test", Keys.TAB);

    Assert.assertEquals(1, findElements(By.className("validation-message")).size());
}

From source file:com.vaadin.demo.registration.RegistrationFormIT.java

License:Apache License

@Test
public void noCrossValidationOnPhoneEmailField() {
    TextFieldElement nameField = $(TextFieldElement.class).get(1);
    nameField.sendKeys("test", Keys.TAB);

    Assert.assertEquals(1, findElements(By.className("validation-message")).size());
}

From source file:com.vaadin.demo.registration.RegistrationFormIT.java

License:Apache License

@Test
public void signupSuccessNotification() {
    TextFieldElement name = $(TextFieldElement.class).get(0);
    TextFieldElement email = $(TextFieldElement.class).get(1);
    PasswordFieldElement password = $(PasswordFieldElement.class).get(0);
    PasswordFieldElement confirmPassword = $(PasswordFieldElement.class).get(1);

    name.sendKeys("Test", Keys.TAB);
    email.sendKeys("test@test.com", Keys.TAB);
    password.sendKeys("aa11bbss33ddd", Keys.TAB);
    confirmPassword.sendKeys("aa11bbss33ddd", Keys.TAB);

    ButtonElement signupButton = $(ButtonElement.class).get(0);
    signupButton.click();/*from w ww.j  a  va2  s  . c  o m*/

    Assert.assertTrue(isElementPresent(By.className("v-Notification-humanized")));
}

From source file:com.vaadin.framework7.samples.SpringCrudIT.java

License:Apache License

@Test
public void validationError() {
    doLogin();/*  ww  w  .  j av  a2  s .c  om*/

    int index = 3;

    List<WebElement> rows = getRows();

    rows.get(index).findElement(By.tagName("td")).click();

    WebElement form = findElement(By.className("product-form"));

    Assert.assertFalse(isElementPresent(By.className("v-errorindicator")));
    Assert.assertFalse(isElementPresent(By.className("v-textfield-error")));

    List<WebElement> fields = form.findElements(By.className("v-textfield"));

    WebElement productName = fields.get(0);
    productName.clear();
    productName.sendKeys("a");
    productName.sendKeys(Keys.TAB);

    Assert.assertTrue(isElementPresent(By.className("v-errorindicator")));
    Assert.assertTrue(isElementPresent(By.className("v-textfield-error")));
}

From source file:com.vaadin.framework8.samples.SpringCrudIT.java

License:Apache License

@Test
public void changeProductNameToValid_bothButtonsAreEnabled() {
    doLogin();/*from  w  ww  .  jav a 2  s  . co m*/

    getRows().get(0).findElement(By.tagName("td")).click();

    WebElement form = findElement(By.className("product-form"));

    List<WebElement> fields = form.findElements(By.className("v-textfield"));

    WebElement productName = fields.get(0);
    productName.clear();
    productName.sendKeys("Updated Product Name");
    productName.sendKeys(Keys.TAB);

    List<WebElement> buttons = form.findElements(By.className("v-button"));
    Assert.assertFalse(isDisabled(buttons.get(0)));
    Assert.assertFalse(isDisabled(buttons.get(1)));
}

From source file:com.vaadin.framework8.samples.SpringCrudIT.java

License:Apache License

@Test
public void changeProductNameToInvalid_saveIsDisabledAndDiscardIsEnabled() {
    doLogin();/*ww  w.ja  v  a2s.co  m*/

    getRows().get(0).findElement(By.tagName("td")).click();

    WebElement form = findElement(By.className("product-form"));

    List<WebElement> fields = form.findElements(By.className("v-textfield"));

    WebElement productName = fields.get(0);
    productName.clear();
    productName.sendKeys("a");
    productName.sendKeys(Keys.TAB);

    List<WebElement> buttons = form.findElements(By.className("v-button"));
    Assert.assertTrue(isDisabled(buttons.get(0)));
    Assert.assertFalse(isDisabled(buttons.get(1)));
}

From source file:com.vaadin.testbench.elements.AbstractTextFieldElement.java

License:Apache License

/**
 * Set value of the field element.//from  w w  w .j a  va2  s .com
 *
 * @param chars
 *            new value of the field
 */
public void setValue(CharSequence chars) throws ReadOnlyException {
    if (isReadOnly()) {
        throw new ReadOnlyException();
    }
    clearElementClientSide(this);
    focus();
    sendKeys(chars);
    sendKeys(Keys.TAB);
}

From source file:com.vaadin.testbench.elements.DateFieldElement.java

License:Apache License

/**
 * Set value of the date field element./*  w  ww .  j  a va 2 s . c  o m*/
 *
 * @param chars
 *            new value of the date field
 * @throws ReadOnlyException
 *             if the date field is in readonly mode
 */
public void setValue(CharSequence chars) throws ReadOnlyException {
    if (isReadOnly()) {
        throw new ReadOnlyException();
    }
    WebElement elem = getInputElement();
    TestBenchElement tbElement = (TestBenchElement) elem;
    clearElementClientSide(tbElement);
    tbElement.sendKeys(chars);
    tbElement.sendKeys(Keys.TAB);
}