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:org.alfresco.po.share.dashlet.TopSiteContributorDashlet.java

License:Open Source License

/**
 * Enters to date into calendar/*from  w w  w  .  j a  va 2 s  .c o m*/
 * 
 * @param toDate String
 * @return HtmlPage
 */
public HtmlPage enterToDate(final String toDate) {
    if (toDate == null || toDate.isEmpty()) {
        throw new UnsupportedOperationException("To date is required");
    }
    try {
        WebElement input = findAndWait(By.cssSelector(TO_DATE_INPUT_FIELD));
        input.clear();
        input.sendKeys(toDate);
        if (logger.isTraceEnabled()) {
            logger.trace("To date entered: " + toDate);
        }
        return getCurrentPage();
    } catch (TimeoutException nse) {
        throw new PageException("Calendar to date drop down not displayed.");
    }
}

From source file:org.alfresco.po.share.dashlet.TopSiteContributorDashlet.java

License:Open Source License

/**
 * Enters to an from date into calendar/*www  . j  av a2 s .  c  o m*/
 * 
 * @param fromDate String
 * @param toDate String
 * @return HtmlPage
 */
public HtmlPage enterFromToDate(final String fromDate, final String toDate) {
    if (fromDate == null || fromDate.isEmpty()) {
        throw new UnsupportedOperationException("From date is required");
    }

    if (toDate == null || toDate.isEmpty()) {
        throw new UnsupportedOperationException("To date is required");
    }

    try {
        List<WebElement> inputFields = getDateInputFields();

        WebElement fromInput = inputFields.get(0);
        WebElement toInput = inputFields.get(1);

        fromInput.clear();
        fromInput.sendKeys(fromDate);

        if (logger.isTraceEnabled()) {
            logger.trace("From date entered: " + toDate);
        }

        toInput.clear();
        toInput.sendKeys(toDate);

        if (logger.isTraceEnabled()) {
            logger.trace("To date entered: " + toDate);
        }
        return getCurrentPage();
    } catch (TimeoutException nse) {
        throw new PageException("Calendar to date drop down not displayed.");
    }
}

From source file:org.alfresco.po.share.EditGroupPage.java

License:Open Source License

/**
 * Edit group/*www . j a v a  2  s .  co  m*/
 * 
 * @param newGroupName -new displayed name of group
 * @param edit - 'true' if Save Changes button must be press, 'false' - Cancel button
 * @return GroupsPage
 */
protected GroupsPage editGroup(String newGroupName, boolean edit) {

    try {
        if (StringUtils.isEmpty(newGroupName)) {
            throw new IllegalArgumentException("Group Name is required.");
        }

        WebElement updateField = findAndWait(UPDATE_DISPLAYNAME_INPUT);
        updateField.clear();
        updateField.sendKeys(newGroupName);

        if (edit) {
            WebElement saveButton = findAndWait(SAVE_CHANGES_BUTTON);
            saveButton.click();
        } else {
            WebElement cancel = driver.findElement(CANCEL_BUTTON);
            cancel.click();
        }

        return groupsPage.render();
    }

    catch (TimeoutException e) {
        if (logger.isTraceEnabled()) {
            logger.trace("Group can not be edited", e);
        }
    }
    throw new PageException("Group can not be edited.");

}

From source file:org.alfresco.po.share.EditGroupPage.java

License:Open Source License

/**
 * Change of the desplayed name of a group
 * /*  w w  w .ja  v a 2 s  .  co m*/
 * @param displayName - new name
 */
public void setDisplayName(String displayName) {
    if (StringUtils.isEmpty(displayName)) {
        throw new PageException("Enter value of DisplayName");
    }
    WebElement input = findAndWait(UPDATE_DISPLAYNAME_INPUT);
    input.clear();
    input.sendKeys(displayName);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter FirstName./*from  w  w  w .ja  va  2s  .c  om*/
 */
public void editFirstName(String text) {
    WebElement input = findAndWait(By.cssSelector(FIRSTNAME));
    input.clear();
    input.sendKeys(text);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter LastName./*ww  w.j a  v  a 2s .  co m*/
 */
public void editLastName(String text) {
    WebElement input = findAndWait(By.cssSelector(LASTNAME));
    input.clear();
    input.sendKeys(text);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter Email.//from w ww  .  j  av a  2  s . c o  m
 */
public void editEmail(String text) {
    WebElement input = findAndWait(By.cssSelector(EMAIL));
    input.clear();
    input.sendKeys(text);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter Password.//from  ww w  .  j a v a2 s . c  o m
 */
public void editPassword(String text) {
    WebElement input = findAndWait(By.cssSelector(PASSWORD));
    input.clear();
    input.sendKeys(text);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter VerifyPassword./*from   w w w  . j  ava  2  s.  c  om*/
 */
public void editVerifyPassword(String text) {
    WebElement input = findAndWait(By.cssSelector(VERIFY_PASSWORD));
    input.clear();
    input.sendKeys(text);
}

From source file:org.alfresco.po.share.EditUserPage.java

License:Open Source License

/**
 * Enter Quota./*w w  w.  j a v  a  2s . co  m*/
 */
public void editQuota(String text) {
    WebElement input = findAndWait(By.cssSelector(USER_QUOTA));
    input.clear();
    input.sendKeys(text);
}