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.musetest.selenium.values.KeystrokesStringSourceTests.java

License:Open Source License

@Test
void testDoubleMixedInMiddle() throws MuseInstantiationException, ValueSourceResolutionError {
    ValueSourceConfiguration source = ValueSourceConfiguration.forTypeWithSource(KeystrokesStringSource.TYPE_ID,
            ValueSourceConfiguration.forValue("1{TAB}{LEFT}2"));
    Object result = source.createSource(new SimpleProject()).resolveValue(new MockStepExecutionContext());
    Assertions.assertEquals("1" + Keys.TAB + Keys.LEFT + "2", result.toString());
}

From source file:org.natica.expense.ExpenseImport.java

public void importExpenes(List<Expense> expenses, String username, String password) {
    setUpDriverConfig(ExpenseConstants.WAITSECONDS);
    openBrowser();/*from w ww.  j a va2  s  . c o m*/
    login(username, password);
    goToExpensePage();
    for (Expense e : expenses) {
        WebElement calendarButton = driver.findElement(By.xpath(ExpenseConstants.CALENDARPOPUPXPATH));
        calendarButton.click();

        String activeMonthYear = driver.findElement(By.xpath(ExpenseConstants.CALENDARACTIVEMONTHXPATH))
                .getText();
        DateFormat format = new SimpleDateFormat("MMMM yyyy");
        Date activeDate = null;
        try {
            activeDate = format.parse(activeMonthYear);
        } catch (ParseException ex) {
            Logger.getLogger(ExpenseImport.class.getName()).log(Level.SEVERE, null, ex);
        }
        Calendar activeDateCal = Calendar.getInstance();
        activeDateCal.setTime(activeDate);

        Calendar expenseEntryDateCal = Calendar.getInstance();
        expenseEntryDateCal.setTime(e.getExpenseEntryDate());
        goToExpenseMonth(activeDateCal, expenseEntryDateCal);

        WebElement expenseDay = findDay(expenseEntryDateCal.get(Calendar.DAY_OF_MONTH),
                expenseEntryDateCal.getActualMaximum(Calendar.DATE));
        expenseDay.click();

        WebElement showButton = driver.findElement(By.xpath(ExpenseConstants.SHOWBUTTONXPATH));
        showButton.click();

        WebElement projectName = driver.findElement(By.xpath(ExpenseConstants.PROJECTNAMEXPATH));
        Select projectNameSelect = new Select(projectName);
        projectNameSelect.selectByVisibleText(e.getProjectName());

        WebElement expenseName = driver.findElement(By.xpath(ExpenseConstants.EXPENSENAMEXPATH));
        Select expenseNameSelect = new Select(expenseName);
        expenseNameSelect.selectByVisibleText(e.getExpenseName());
        expenseName.sendKeys(Keys.TAB);
        waitSeconds(3);

        WebElement description = driver.findElement(By.xpath(ExpenseConstants.EXPENSEDESCRIPTIONXPATH));
        description.sendKeys(Keys.chord(Keys.CONTROL, "a"), e.getDescription());
        description.sendKeys(Keys.TAB);

        WebElement paymentMethod = driver.findElement(By.xpath(ExpenseConstants.PAYMENTMETHODXPATH));
        Select paymentMethodSelect = new Select(paymentMethod);
        paymentMethodSelect.selectByVisibleText(e.getPaymentMethod());

        WebElement netAmount = driver.findElement(By.xpath(ExpenseConstants.NETAMOUNTXPATH));
        netAmount.sendKeys(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
                e.getNetAmount().toString().replace(".", ","));
        netAmount.sendKeys(Keys.TAB);
        waitSeconds(3);

        WebElement addButton = driver.findElement(By.xpath(ExpenseConstants.ADDBUTTONXPATH));
        addButton.click();
        acceptNextAlert = true;
        closeAlertAndGetItsText();

        WebElement submitButton = driver.findElement(By.xpath(ExpenseConstants.SUBMITBUTTONXPATH));
        submitButton.click();

    }
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInStockAtFirstOfMonth(String value, int rowNumber) {
    rowNumber = rowNumber - 1;/* w  w  w  .  j  a v a2  s  .  c om*/
    WebElement stockAtFirstOfMonth = testWebDriver.getElementByName("stockAtFirstOfMonth" + rowNumber);
    sendKeys(stockAtFirstOfMonth, value);
    stockAtFirstOfMonth.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInReceived(String value, int rowNumber) {
    rowNumber = rowNumber - 1;//from  w ww .j a v a2 s . co m
    WebElement received = testWebDriver.getElementByName("received" + rowNumber);
    sendKeys(received, value);
    received.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInDistributed(String value, int rowNumber) {
    rowNumber = rowNumber - 1;/*  w  w  w.  jav a2  s .com*/
    WebElement distributed = testWebDriver.getElementByName("distributed" + rowNumber);
    sendKeys(distributed, value);
    distributed.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInLoss(String value, int rowNumber) {
    rowNumber = rowNumber - 1;/* www .  j  a v  a 2s.c  om*/
    WebElement loss = testWebDriver.getElementByName("loss" + rowNumber);
    sendKeys(loss, value);
    loss.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInStockAtEndOfMonth(String value, int rowNumber) {
    rowNumber = rowNumber - 1;/*from   ww w . jav a2 s .  c  o m*/
    WebElement stockAtEndOfMonth = testWebDriver.getElementByName("stockAtEndOfMonth" + rowNumber);
    sendKeys(stockAtEndOfMonth, value);
    stockAtEndOfMonth.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.EPIUsePage.java

License:Open Source License

public void enterValueInExpirationDate(String value, int rowNumber) {
    rowNumber = rowNumber - 1;// w  w w  .j  a v  a2 s  .  c  om
    WebElement expirationDate = testWebDriver.getElementByName("expirationDate" + rowNumber);
    sendKeys(expirationDate, value);
    expirationDate.sendKeys(Keys.TAB);
}

From source file:org.openlmis.pageobjects.FacilityPage.java

License:Open Source License

public String enterValuesInFacility(String facilityCodePrefix, String facilityNamePrefix, String program,
        String geoZone, String facilityTypeValue, String operatedByValue, String population, boolean push) {

    Date dObj = new Date();
    SimpleDateFormat formatter_date_time = new SimpleDateFormat("yyyyMMdd-hhmmss");
    String date_time = formatter_date_time.format(dObj);

    String facilityCodeText = facilityCodePrefix + date_time;
    String facilityNameText = facilityNamePrefix + date_time;
    testWebDriver.waitForElementToAppear(facilityCode);
    sendKeys(facilityCode, facilityCodeText);
    sendKeys(facilityName, facilityNameText);

    testWebDriver.selectByVisibleText(operatedBy, operatedByValue);

    testWebDriver.clickForRadio(serviceDeliveryPoint);
    testWebDriver.clickForRadio(isActiveTrue);

    sendKeys(facilityDescription, "Testing description");
    sendKeys(gln, "Testing Gln");
    sendKeys(phoneNumber, "9711231305");
    sendKeys(faxNumber, "9711231305");
    sendKeys(address1, "Address1");
    sendKeys(address2, "Address2");

    testWebDriver.selectByVisibleText(facilityType, facilityTypeValue);

    testWebDriver.scrollToElement(geographicZone);
    testWebDriver.sleep(500);//from   www. j a va 2  s. com

    testWebDriver.selectByVisibleText(geographicZone, geoZone);
    testWebDriver.sleep(500);

    goLiveDate.click();
    testWebDriver.sleep(500);
    goLiveDateCalender.click();
    testWebDriver.sleep(500);
    goDownDate.click();
    testWebDriver.sleep(500);
    goDownDateCalender.click();

    addProgram(program, push);

    testWebDriver.scrollToElement(altitude);
    testWebDriver.sleep(500);
    sendKeys(catchmentPopulation, population);
    sendKeys(latitude, "-555.5555");
    sendKeys(longitude, "444.4444");
    sendKeys(altitude, "4545.4545");

    testWebDriver.scrollToElement(coldStorageGrossCapacity);
    testWebDriver.sleep(500);
    sendKeys(coldStorageGrossCapacity, "3434.3434");
    sendKeys(coldStorageNetCapacity, "3535.3535");
    coldStorageNetCapacity.sendKeys(Keys.TAB);

    hasElectricityTrue.click();
    isOnlineTrue.click();
    testWebDriver.handleScrollByPixels(0, 2000);
    testWebDriver.sleep(500);
    hasElectronicSccTrue.click();
    hasElectronicDarTrue.click();
    facilitySuppliesOthersYes.click();
    sendKeys(comments, "Comments");
    return date_time;
}

From source file:org.openlmis.pageobjects.FullCoveragePage.java

License:Open Source License

public void enterFemaleHealthCenter(Integer femaleHealthCenter) {
    testWebDriver.waitForElementToAppear(femaleHealthCenterField);
    sendKeys(femaleHealthCenterField, femaleHealthCenter.toString());
    femaleHealthCenterField.sendKeys(Keys.TAB);
}