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.hotwire.selenium.desktop.hotelextranet.ExtranetHotelOverviewPage.java

License:Open Source License

/**
 * Select the start and end date using the datepicker
 *
 * @param startDate//from w w  w .  ja  v a 2s .  com
 * @param endDate
 *
 */
public void selectDates(Date startDate, Date endDate) {
    sendKeys(startDateField, DatePicker.getFormattedDate(startDate) + Keys.TAB);
    sendKeys(endDateField, DatePicker.getFormattedDate(endDate) + Keys.TAB);
}

From source file:com.hotwire.selenium.desktop.hotelextranet.ExtranetHotelReviewBookingsPage.java

License:Open Source License

/**
 * Select the start and end date using the datepicker
 *
 * @param startDate//from   ww w.j a  v a2s.c  om
 * @param endDate
 *
 */

public void selectDates(Date startDate, Date endDate, String searchType) {
    try {
        new DatePicker(getWebDriver(), startDateField).selectDate(startDate);
    } catch (NoSuchElementException e) {
        startDateField.clear();
        startDateField.sendKeys(DatePicker.getFormattedDate(startDate) + Keys.TAB);
    }
    try {
        new DatePicker(getWebDriver(), endDateField).selectDate(endDate);
    } catch (NoSuchElementException e) {
        endDateField.clear();
        endDateField.sendKeys(DatePicker.getFormattedDate(endDate) + Keys.TAB);
    }
    ExtendedSelect select = new ExtendedSelect(searchBy);
    select.selectIfVisibleTextContainsText(searchType);
}

From source file:com.hotwire.selenium.desktop.hotelextranet.ExtranetReviewChangeRequestPage.java

License:Open Source License

public void reviewChanges(Date startDate, Date endDate) {
    try {/*from   www .j  a  v  a  2  s.com*/
        new DatePicker(getWebDriver(), startDateField).selectDate(startDate);
    } catch (NoSuchElementException e) {
        startDateField.clear();
        startDateField.sendKeys(DatePicker.getFormattedDate(startDate) + Keys.TAB);
    }
    try {
        new DatePicker(getWebDriver(), endDateField).selectDate(endDate);
    } catch (NoSuchElementException e) {
        endDateField.clear();
        endDateField.sendKeys(DatePicker.getFormattedDate(endDate) + Keys.TAB);
    }
    goButton.click();
}

From source file:com.hotwire.selenium.desktop.row.search.HomePageFareFinder.java

License:Open Source License

@SuppressWarnings("unused")
private void findFare(String destinationLocation, Date startDate, Date endDate, Integer numberOfHotelRooms,
        Integer numberOfAdults, Integer numberOfChildren) {
    this.destination.click();
    this.destination.clear();
    this.destination.sendKeys(destinationLocation + Keys.TAB);
    new WebDriverWait(getWebDriver(), DEFAULT_WAIT).until(PageObjectUtils.webElementVisibleTestFunction(
            fareFinderForm.findElement(By.className(FARE_FINDER_AUTOCOMPLETE_CONTENT)), false));

    DatePicker startDatePicker = new DatePicker(getWebDriver(), checkInDateField);
    startDatePicker.selectDate(startDate);

    DatePicker endDatePicker = new DatePicker(getWebDriver(), checkOutDateField);
    endDatePicker.selectDate(endDate);//from w  w  w . j a va2 s  . c om

    Select roomsCountSelect = new Select(rooms);
    roomsCountSelect
            .selectByVisibleText((numberOfHotelRooms == null) ? "1" : Integer.toString(numberOfHotelRooms));

    Select adultsCountSelect = new Select(roomsAdults);
    adultsCountSelect.selectByVisibleText((numberOfAdults == null) ? "2" : Integer.toString(numberOfAdults));

    Select childCountSelect = new Select(roomsChild);
    childCountSelect.selectByVisibleText((numberOfChildren == null) ? "0" : Integer.toString(numberOfChildren));

    // todo: changing this from click to submit till we figure out issue with calendar popup
    findButton.submit();
}

From source file:com.hotwire.selenium.desktop.us.results.car.fragments.fareFinder.CcfCarFareFinder.java

License:Open Source License

@Override
public CarFareFinder setPickUpDate(Date date) {
    setText(startDate, (new SimpleDateFormat("MM/dd/yy")).format(date) + Keys.TAB);
    return this;
}

From source file:com.hotwire.selenium.desktop.us.results.car.fragments.fareFinder.CcfCarFareFinder.java

License:Open Source License

@Override
public CarFareFinder setDropOffDate(Date date) {
    setText(endDate, (new SimpleDateFormat("MM/dd/yy")).format(date) + Keys.TAB);
    return this;
}

From source file:com.hotwire.selenium.desktop.us.search.ActivitiesSearchFragment.java

License:Open Source License

public void findFare(String destination, Date startDate, Date endDate) {

    //Check to see if we landed on the activities page or not; validate fareFinder

    try {//from  w ww  . j a  v  a2 s . c om
        new WebDriverWait(getWebDriver(), DEFAULT_WAIT)
                .until(PageObjectUtils.webElementVisibleTestFunction(activityFareFinder, true));
    } catch (NoSuchElementException e) {
        logger.info("Activities page has an error. No activities fare finder");
    }

    //First check if city mentioned is already there in the finder;
    //else enter it into the city field.

    ArrayList<String> destinationNames = getDestinations();
    if (destinationNames.contains(destination)) {
        getWebDriver().findElement(By.xpath(".//input[@value='" + destination + "']")).click();
    } else {
        destLocation.clear();
        destLocation.sendKeys(destination + Keys.TAB);
    }
    startDateField.clear();
    DatePicker startDatePicker = new DatePicker(getWebDriver(), startDateField);
    startDatePicker.typeDate(DatePicker.getFormattedDate(startDate) + Keys.TAB);
    endDateField.clear();
    DatePicker endDatePicker = new DatePicker(getWebDriver(), endDateField);
    endDatePicker.typeDate(DatePicker.getFormattedDate(endDate) + Keys.TAB);
    submit.click();
}

From source file:com.hotwire.selenium.desktop.us.search.AirChangeSearchLayer.java

License:Open Source License

public AirResultsPage changeSearchLocations(String fromLocation, String toLocation) {
    AirChangeSearchLayer airChangeSearchLayer = new AirChangeSearchLayer(getWebDriver());
    getCurrentState();//from www  . java 2  s. c o  m
    try {
        airChangeSearchLayer.fromLocation.clear();
    } catch (NoSuchElementException e) {
        logger.info("Change layer is not invoked");
    }
    airChangeSearchLayer.fromLocation.sendKeys(fromLocation + Keys.TAB);
    airChangeSearchLayer.toLocation.clear();
    airChangeSearchLayer.toLocation.sendKeys(toLocation + Keys.TAB);
    airChangeSearchLayer.searchButton.click();
    return new AirResultsPage(getWebDriver());
}

From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java

License:Open Source License

private void selectStartDate(Date startDate) {
    sendKeys(this.startDateField, DatePicker.getFormattedDate(startDate) + Keys.TAB);
    LOGGER.info("Selecting start date: {}", DatePicker.getFormattedDate(startDate));
}

From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java

License:Open Source License

private void selectEndDate(Date endDate) {
    sendKeys(this.endDateField, DatePicker.getFormattedDate(endDate) + Keys.TAB);
    LOGGER.info("Selecting end date: {}", DatePicker.getFormattedDate(endDate));
}