List of usage examples for org.openqa.selenium Keys TAB
Keys TAB
To view the source code for org.openqa.selenium Keys TAB.
Click Source Link
From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java
License:Open Source License
public AirSearchFragment withStartDate(Date date) { if (date != null) { sendKeys(startDateField, (new SimpleDateFormat("MM/dd/yy")).format(date) + Keys.TAB); }//from w ww . j a v a2 s . c o m return new AirSearchFragment(getWebDriver()); }
From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java
License:Open Source License
public AirSearchFragment withEndDate(Date date) { if (date != null) { sendKeys(endDateField, (new SimpleDateFormat("MM/dd/yy")).format(date) + Keys.TAB); } else {// ww w .j a v a 2 s. c o m oneWayRadioButton.click(); /* new WebDriverWait(getWebDriver(), MENU_VISIBLE_WAIT).until( ExpectedConditions.elementSelectionStateToBe(oneWayRadioButton, true));*/ } return new AirSearchFragment(getWebDriver()); }
From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java
License:Open Source License
public AirSearchFragment multiCityRoute(String departure1, String arrival1, Date date1, String departure2, String arrival2, Date date2) { if (departure1 != null) { multiRadioButton.click();/*from w ww . j a va2 s . com*/ new WebDriverWait(getWebDriver(), MENU_VISIBLE_WAIT) .until(ExpectedConditions.elementSelectionStateToBe(multiRadioButton, true)); sendKeys(fromLocationForRoute1, departure1); sendKeys(toLocationForRoute1, arrival1); sendKeys(startDateForRoute1Field, (new SimpleDateFormat("MM/dd/yy")).format(date1) + Keys.TAB); sendKeys(fromLocationForRoute2, departure2); sendKeys(toLocationForRoute2, arrival2); sendKeys(startDateForRoute2, (new SimpleDateFormat("MM/dd/yy")).format(date2) + Keys.TAB); } return new AirSearchFragment(getWebDriver()); }
From source file:com.hotwire.selenium.desktop.us.search.AirSearchFragment.java
License:Open Source License
public AirSearchFragment addMoreFlights(String departure1, String arrival1, Date date1, String departure2, String arrival2, Date date2) { if (departure1 != null) { addMoreFlights.click();//from ww w . j ava2 s.c om new WebDriverWait(getWebDriver(), MENU_VISIBLE_WAIT) .until(ExpectedConditions.visibilityOf(fromLocationForRoute3)); sendKeys(fromLocationForRoute3, departure1); sendKeys(toLocationForRoute3, arrival1); sendKeys(startDateForRoute3, (new SimpleDateFormat("MM/dd/yy")).format(date1) + Keys.TAB); sendKeys(fromLocationForRoute4, departure2); sendKeys(toLocationForRoute4, arrival2); sendKeys(startDateForRoute4, (new SimpleDateFormat("MM/dd/yy")).format(date2) + Keys.TAB); } return new AirSearchFragment(getWebDriver()); }
From source file:com.hotwire.selenium.desktop.us.search.CarSearchFragment.java
License:Open Source License
public CarSearchFragment endDate(Date endDate) { if (endDate != null) { sendKeys(endDateField, (new SimpleDateFormat("MM/dd/yy")).format(endDate) + Keys.TAB); }/*from ww w . java 2s.c o m*/ return this; }
From source file:com.hotwire.selenium.desktop.us.search.CarSearchFragment.java
License:Open Source License
public CarSearchFragment startDate(Date startDate) { // DatePicker solution doesn't work when start or end date more than 330 days from now so doing sendKeys. if (startDate != null) { sendKeys(startDateField, (new SimpleDateFormat("MM/dd/yy")).format(startDate) + Keys.TAB); }/*from w w w . j a v a2s . c o m*/ return this; }
From source file:com.hotwire.selenium.desktop.widget.AutoComplete.java
License:Open Source License
private void focusOut() { nativeDropDown.sendKeys(Keys.TAB); }
From source file:com.hotwire.test.steps.search.car.CarSearchModelWebApp.java
License:Open Source License
@Override public void verifySuggestedLocation(String number, String expectedAutoCompleteItem, String style, String click) {/*from w w w. j a v a 2s .c o m*/ CarSearchFragment carSearchFragment = new CarSearchFragment(getWebdriverInstance()); carSearchFragment.isAutoCompleteDisplayed(); LOGGER.info("Auto-complete is visible"); ArrayList<String> autocomleteContents = carSearchFragment.getAutocomleteContents(); ArrayList<String> autocompleteAttributes = carSearchFragment.getAttibutesForAutocomplete("class"); List<WebElement> autocomleteElements = carSearchFragment.getAutocompleteElements(); Integer i = autocomleteContents.indexOf(expectedAutoCompleteItem); if (number != null) { if (number.trim().equals("first")) { assertThat(i == 0).as("First auto-complete item is : " + expectedAutoCompleteItem).isTrue(); } else if (number.trim().equals("second")) { assertThat(i == 1).as("Second auto-complete item is : " + expectedAutoCompleteItem).isTrue(); } else if (number.trim().equals("third")) { assertThat(i == 2).as("Third auto-complete item is : " + expectedAutoCompleteItem).isTrue(); } } else { assertThat(i != -1).isTrue(); } if (style != null) { if (style.trim().equals("underlined and highlighted")) { assertThat(autocompleteAttributes.get(i).contains("yui-ac-highlight")) .as("N" + i.toString() + " auto-complete item is highlighted and underlined").isTrue(); } } if (click != null) { if (click.trim().equals("and I click it")) { autocomleteElements.get(i).click(); try { carSearchFragment.isAutoCompleteDisplayed(); throw new InvalidElementStateException(); } catch (TimeoutException e) { LOGGER.info("Auto-complete is invisible"); } // This is a hack. For some reason, focus is still on this element and typing start date appends to // this element instead of the start date element. Attempt to send tab key to get off this element. carSearchFragment.getStartLocation().sendKeys(Keys.TAB); } } }
From source file:com.hotwire.test.steps.search.golocalsearch.GoLocalSearchModelWebApp.java
License:Open Source License
@Override public void setDates(Date startDate, Date endDate) { GoLocalSearchPage localSearchPage = new GoLocalSearchPage(getWebdriverInstance()); if (startDate != null) { localSearchPage.getStartDate().clear(); localSearchPage.getStartDate()/* www .ja v a 2s .com*/ .sendKeys((new SimpleDateFormat("MM/dd/yy")).format(startDate) + Keys.TAB); } if (endDate != null) { localSearchPage.getEndDate().clear(); localSearchPage.getEndDate().sendKeys((new SimpleDateFormat("MM/dd/yy")).format(endDate) + Keys.TAB); } }
From source file:com.hotwire.test.steps.search.hotel.HotelSearchModelWebApp.java
License:Open Source License
@Override public void verifySuggestedLocation(String number, String expectedAutoCompleteItem, String style, String click) {/*w ww. j a va 2 s . c om*/ HotelSearchFragment hotelSearchFragment = new HotelSearchFragment(getWebdriverInstance()); hotelSearchFragment.isAutoCompleteDisplayed(); LOGGER.info("Auto-complete is visible"); ArrayList<String> autocomleteContents = hotelSearchFragment.getAutocompleteContents(); ArrayList<String> autocompleteAttributes = hotelSearchFragment.getAttibutesForAutocomplete("class"); List<WebElement> autocomleteElements = hotelSearchFragment.getAutocompleteElements(); Integer i; i = autocomleteContents.indexOf(expectedAutoCompleteItem); if (number != null) { if (number.trim().equals("first")) { assertThat(i == 0).as("First auto-complete item is : " + expectedAutoCompleteItem).isTrue(); } } else { assertThat(i != -1).isTrue(); } if (style != null) { if (style.trim().equals("underlined and highlighted")) { assertThat(autocompleteAttributes.get(i).contains("yui-ac-highlight")) .as("N" + i.toString() + " auto-complete item is highlighted and underlined").isTrue(); } } if (click != null) { if (click.trim().equals("and I click it")) { autocomleteElements.get(i).click(); try { hotelSearchFragment.isAutoCompleteDisplayed(); throw new InvalidElementStateException(); } catch (TimeoutException e) { LOGGER.info("Auto-complete is invisible"); } // This is a hack. For some reason, focus is still on this element and typing start date appends to // this element instead of the start date element. Attempt to send tab key to get off this element. hotelSearchFragment.getDestCity().sendKeys(Keys.TAB); } } }