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:org.openlmis.pageobjects.VisitInformationPage.java

License:Open Source License

public void enterOtherReasonInTextBox(String reason) {
    testWebDriver.waitForElementToAppear(otherTextBox);
    sendKeys(otherTextBox, reason);
    otherTextBox.sendKeys(Keys.TAB);
}

From source file:org.openlmis.UiUtils.TestWebDriver.java

License:Open Source License

public void keyPress(final WebElement element) {
    waitForElementToAppear(element);/*from w w w.  ja v a 2s .  c o m*/

    if (driver instanceof FirefoxDriver) {
        element.sendKeys(Keys.RETURN);
        return;
    }

    if (element != null) {
        for (int i = 0; i < 15; i++) {
            element.sendKeys(Keys.TAB);
            if (driver.switchTo().activeElement().getText().equalsIgnoreCase(element.getText())) {
                break;
            }
        }
        element.sendKeys(Keys.RETURN);
    }
}

From source file:org.openmrs.module.mirebalais.smoke.pageobjects.AbstractPageObject.java

License:Open Source License

public void hitTabKey() {
    driver.switchTo().activeElement().sendKeys(Keys.TAB);
}

From source file:org.openmrs.module.mirebalais.smoke.pageobjects.AbstractPageObject.java

License:Open Source License

public void hitTabKey(By elementId) {
    driver.findElement(elementId).sendKeys(Keys.TAB);
}

From source file:org.openmrs.steps.CreateConceptDrugSteps.java

License:Mozilla Public License

@When("I mention $name, $concept, $doseStrength, $units, $maximumDose and $minimumDose")
public void addDrugDetails(String name, String concept, String doseStrength, String units, String maximumDose,
        String minimumDose) throws InterruptedException {
    type(name, into(textbox().with(attribute("name", equalTo("name")))));
    //editing the concept
    type(concept, into(textbox().with(attribute("id", equalTo("concept_selection")))));
    Thread.sleep(1000);/*from   www.  j av  a  2 s.c  o  m*/
    WebElement conceptSelection = driver.findElement(By.id("concept_selection"));
    conceptSelection.sendKeys(Keys.TAB);
    //editing the combination
    clickOn(checkbox().with(attribute("name", equalTo("combination"))));

    //editing dose strength
    type(doseStrength, into(textbox().with(attribute("name", equalTo("doseStrength")))));

    //editing unit
    type(units, into(textbox().with(attribute("name", equalTo("units")))));

    //editing maximum dose
    type(maximumDose, into(textbox().with(attribute("name", equalTo("maximumDailyDose")))));

    //editing minimum dose
    type(minimumDose, into(textbox().with(attribute("name", equalTo("minimumDailyDose")))));
}

From source file:org.openmrs.steps.CreateEncounterSteps.java

License:Mozilla Public License

@When("I enter $name, $provider, $location, $date, $providerRole")
public void enterDetails(String name, String provider, String location, String date, String providerRole)
        throws InterruptedException {
    Thread.sleep(2000);//from w ww .  j av  a2 s .  co m
    type(name, into(textbox().with(attribute("id", equalTo("patientId_id_selection")))));
    String autoCompleteXPath = "//ul[@class='ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all']";
    waitFor(finderByXpath(autoCompleteXPath));
    clickOn(finderByXpath(autoCompleteXPath));

    selectFrom(location, "location");
    type(date, into(textbox().with(attribute("name", equalTo("encounterDatetime")))));
    clickOn(textbox().with(attribute("name", equalTo("encounterDatetime"))));
    getWebDriver().findElement(By.id("addProviderButton")).click();
    selectFrom(providerRole, "roleIds[0]");
    type(provider, into(textbox().with(attribute("id", equalTo("providers[0]")))));
    WebElement providerElement = driver.findElement(By.id("providers[0]"));
    providerElement.sendKeys(Keys.TAB);
}

From source file:org.openmrs.steps.EditConceptDrugSteps.java

License:Mozilla Public License

@When("I change $name, $concept, $doseStrength, $units, $maximumDose and $minimumDose")
public void editDrug(String name, String concept, String doseStrength, String units, String maximumDose,
        String minimumDose) throws InterruptedException {
    //editing $name into name textbox
    Thread.sleep(2000);//  w  w w . j a  va  2s  . co m
    type(name, into(textbox().with(attribute("name", equalTo("name")))));
    type(concept, into(textbox().with(attribute("id", equalTo("concept_selection")))));
    Thread.sleep(1000);
    WebElement conceptSelection = driver.findElement(By.id("concept_selection"));
    conceptSelection.sendKeys(Keys.TAB);

    //editing the combination
    clickOn(checkbox().with(attribute("name", equalTo("combination"))));

    //editing dose strength
    type(doseStrength, into(textbox().with(attribute("name", equalTo("doseStrength")))));

    //editing unit
    type(units, into(textbox().with(attribute("name", equalTo("units")))));

    //editing maximum dose
    type(maximumDose, into(textbox().with(attribute("name", equalTo("maximumDailyDose")))));

    //editing minimum dose
    type(minimumDose, into(textbox().with(attribute("name", equalTo("minimumDailyDose")))));
}

From source file:org.richfaces.component.validation.ITValidatorMessageWithLabel.java

License:Open Source License

/**
 * <p>Tests that validation message contains a label, i.e. content of "label" attribute of h:inputText component. This
 * is not default behavior, there is following setting in file MessagesWithLabels.properties:
 * javax.faces.validator.BeanValidator.MESSAGE={1}: {0}</p>
 *
 * <p>{@link https://issues.jboss.org/browse/RF-12754}</p>
 *///from  w  w  w  .  ja  va2  s  .  c  om
@Test
@Category(Failing.class)
public void client_side_validation_msg() {
    // given
    browser.get(contextPath.toExternalForm());
    WebElement input = browser.findElement(By.id("myForm:input1"));

    input.sendKeys("RichFaces");
    Graphene.guardNoRequest(input).sendKeys(Keys.TAB);

    WebElement message = browser.findElement(By.id("myForm:msg1"));
    Assert.assertEquals("Validation message", "Input 1: max 4 characters", message.getText());
}

From source file:org.richfaces.showcase.notify.page.NotifyAttributesPage.java

License:Open Source License

private void setInputValueTo(WebElement input, double value) {
    Action action = actions.click(input).sendKeys(Keys.chord(Keys.CONTROL, "a"), String.valueOf(value))
            // blur the input
            .sendKeys(Keys.TAB).build();
    if (!input.getAttribute("value").equals(String.valueOf(value))) {
        // value was changed => ajax request
        action = Graphene.guardAjax(action);
    }// w  w  w .  jav  a2  s  .c  om
    action.perform();
}

From source file:org.richfaces.tests.metamer.ftest.richCalendar.TestCalendarKeyboardNavigation.java

License:Open Source License

@Test
public void testTimeEditor() {
    String datePattern = "dd/M/yy hh:mm:ss a";
    calendarAttributes.set(CalendarAttributes.datePattern, datePattern);

    PopupCalendar calendarPopup = setReferenceDate_openPopup_check();
    assertCalendarInputEqualsTo("01/1/12 12:00:00 PM");

    keyboard.sendKeys(OPEN_TIME_EDITOR_KEY);
    TimeEditor timeEditor = calendarPopup.getFooterControls().getTimeEditor();
    timeEditor.waitUntilIsVisible().perform();

    // increase hours by 2
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    // switch to minutes
    keyboard.sendKeys(Keys.TAB);
    // decrease minutes by 3
    keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY);
    keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY);
    keyboard.sendKeys(TIME_SPINNER_DECREASE_KEY);
    // switch to seconds
    keyboard.sendKeys(Keys.TAB);//  w ww . j av  a 2s .co  m
    // increase seconds by 1
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    // switch to time sign
    keyboard.sendKeys(Keys.TAB);
    // change time sign
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    // switch to hours again
    keyboard.sendKeys(Keys.TAB);
    // increase hours by 1
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    // switch to minutes again
    keyboard.sendKeys(Keys.TAB);
    // switch to seconds again
    keyboard.sendKeys(Keys.TAB);
    // increase seconds by 1
    keyboard.sendKeys(TIME_SPINNER_INCREASE_KEY);
    // confirm
    keyboard.sendKeys(Keys.ENTER);
    // apply
    Graphene.guardAjax(keyboard).sendKeys(Keys.ENTER);
    assertCalendarInputEqualsTo("01/1/12 03:57:02 AM");
}