Example usage for org.openqa.selenium WebElement clear

List of usage examples for org.openqa.selenium WebElement clear

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement clear.

Prototype

void clear();

Source Link

Document

If this element is a form entry element, this will reset its value.

Usage

From source file:com.hotwire.selenium.desktop.subscription.SubscriptionModuleFragment.java

License:Open Source License

public void typeEmail(String email) {
    WebElement emailElement = getWebDriver()
            .findElement(By.cssSelector(SUBSCRIPTION_MODULE + " input[name='email']"));
    emailElement.clear();
    emailElement.sendKeys(email);/*from  w w w .  ja  va 2s.  c o  m*/
}

From source file:com.hotwire.selenium.desktop.subscription.SubscriptionModuleFragment.java

License:Open Source License

public void typeZipcode(String zipCode) {
    WebElement emailElement = getWebDriver()
            .findElement(By.cssSelector(SUBSCRIPTION_MODULE + " input[name='zipCode']"));
    emailElement.clear();
    emailElement.sendKeys(zipCode);/*  w w  w. j ava 2  s.  c  om*/
}

From source file:com.hotwire.selenium.desktop.us.billing.car.impl.ccf.CcfPaymentMethodFragment.java

License:Open Source License

@Override
public CarPaymentMethod payPalUser(String firstName, String lastName) {
    WebElement payPalFirstName = getPayPalFirstName();
    WebElement payPalLastName = getPayPalLastName();
    payPalFirstName.clear();
    payPalFirstName.sendKeys(firstName);

    payPalLastName.clear();// w w  w. j a v  a2  s  .  c  om
    payPalLastName.sendKeys(lastName);
    return this;
}

From source file:com.hotwire.selenium.desktop.us.billing.onepage.HotelTravelerInfoFragment.java

License:Open Source License

public HotelBillingOnePage signInAsUser(String user, String password) {
    clickSignInLink();/* ww w .  jav  a2  s . co m*/
    WebElement email = getWebDriver().findElement(By.cssSelector(SIGN_IN_EMAIL));
    email.clear();
    email.sendKeys(user);
    WebElement passwd = getWebDriver().findElement(By.cssSelector(SIGN_IN_PASSWORD));
    passwd.clear();
    passwd.sendKeys(password);
    getWebDriver().findElement(By.cssSelector(SIGN_IN_SUBMIT)).click();
    return new HotelBillingOnePage(getWebDriver());
}

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

License:Open Source License

private void setText(WebElement webElement, String text) {
    webElement.clear();
    webElement.sendKeys(text);
}

From source file:com.hotwire.selenium.desktop.us.results.hotel.fragments.tripwatcher.HotelResultsTripwatcherLayerFragment.java

License:Open Source License

public void watchThisTrip(String newEmail) {
    if (newEmail.trim().equals("empty")) {
        newEmail = "";
    }//  w  w  w  . j a va  2 s  . c o  m
    WebElement signupEmail = getVisibleTripWatcherEmailElement();
    signupEmail.clear();
    signupEmail.sendKeys(newEmail);
    getVisibleTripWatcherSubscribeButton().click();
    new WebDriverWait(getWebDriver(), EXTRA_WAIT)
            .until(PageObjectUtils.webElementVisibleTestFunction(By.cssSelector(".success"), true));
    assertThat(getWebDriver().findElement(By.cssSelector(".success")).getText()).contains(SUCCESSFUL_MESSAGE);
    closeButton.click();
}

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

License:Open Source License

public void selectStartDate(Date startDate) {
    WebElement startDateField = getWebDriver().findElement(By.cssSelector(START_DATE));
    if (startDateField != null) {
        try {/*from   ww w. j a v  a 2s . co m*/
            new DatePicker(getWebDriver(), startDateField).selectDate(startDate);
        } catch (WebDriverException e) {
            LOGGER.info("Date picker issue for start date. Entering date manually.");
            SimpleDateFormat sdf = DatePicker.getSelectedCountryDateFormat(getWebDriver());
            startDateField.clear();
            startDateField.sendKeys(sdf.format(startDate));
        }
    } else {
        LOGGER.error("Start date field is not displayed on hotel landing page..");
    }
}

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

License:Open Source License

public void selectEndDate(Date endDate) {
    WebElement endDateField = getWebDriver().findElement(By.cssSelector(END_DATE));
    if (endDateField != null) {
        try {//from w w  w  . ja va 2 s  . c  o m
            new DatePicker(getWebDriver(), endDateField).selectDate(endDate);
        } catch (WebDriverException e) {
            LOGGER.info("Date picker issue for end date. Entering date manually.");
            SimpleDateFormat sdf = DatePicker.getSelectedCountryDateFormat(getWebDriver());
            endDateField.clear();
            endDateField.sendKeys(sdf.format(endDate));
        }
    } else {
        LOGGER.error("End date field is not displayed on hotel landing page..");
    }
}

From source file:com.hotwire.selenium.tools.travelAdvisory.TravelAdvisoryUpdatesPage.java

License:Open Source License

private void setIssueField(String fieldName, String text) {
    final WebElement webElement = findMany(By.name(fieldName)).get(index);
    webElement.clear();
    webElement.sendKeys(text);/*from   ww w. j  a va 2  s  .  c om*/
}

From source file:com.htmlhifive.test.selenium.testcase.coverage.BrowserCheckTest.java

License:Apache License

@Test
public void showBrowserCheckPage() throws InterruptedException {

    WebElement locationBox = querySelector("#location").get(0);
    locationBox.clear();
    locationBox.sendKeys("http://localhost:8080/htmlhifiveWeb/coverage/webdriver/sandboxInternal/coverage/");
    WebElement openInFrame = querySelector("[title='open URL in the iframe below [Enter]']").get(0);
    openInFrame.click();/*from   w  w w. java  2 s . co  m*/
    Thread.sleep(100);
    getDriver().switchTo().defaultContent();
    Thread.sleep(100);
}