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.cmm.admin.EditPropertyGroupPopUp.java

License:Open Source License

/**
 * Sets the description field./*from  w w  w  . ja v  a  2 s.  co  m*/
 * 
 * @param description the description
 * @return the EditPropertyGroupPopUp
 */
public EditPropertyGroupPopUp setDescriptionField(String description) {
    PageUtils.checkMandatoryParam("description", description);
    try {
        WebElement descField = findAndWait(DESCRIPTION_FIELD);
        descField.clear();
        descField.sendKeys(description);
        return this;
    } catch (TimeoutException toe) {
        throw new PageOperationException("Not visible Element: DESCRIPTION_FIELD", toe);
    }
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyPopUp.java

License:Open Source License

/**
 * Sets the constraint min length field.
 * /*www.  ja  va  2s .  c  o  m*/
 * @param value the value
 * @return the CreateNewPropertyPopUp
 */
public void setConstraintMinLengthField(String value) {
    if (isElementDisplayed(CONSTRAINT_MIN_LENGTH_FIELD)) {
        try {
            WebElement field = findAndWait(CONSTRAINT_MIN_LENGTH_FIELD);
            field.clear();
            field.sendKeys(value);
        } catch (TimeoutException toe) {
            throw new PageOperationException("Not visible Element: CONSTRAINT_MIN_LENGTH_FIELD ", toe);
        }
    }
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyPopUp.java

License:Open Source License

/**
 * Sets the constraint max length field.
 * /*from   w w  w  .j a  v  a 2s. c  o m*/
 * @param value the value
 * @return the CreateNewPropertyPopUp
 */
public void setConstraintMaxLengthField(String value) {
    if (isElementDisplayed(CONSTRAINT_MAX_LENGTH_FIELD)) {
        try {
            WebElement field = findAndWait(CONSTRAINT_MAX_LENGTH_FIELD);
            field.clear();
            field.sendKeys(value);
        } catch (TimeoutException toe) {
            throw new PageOperationException("Not visible Element: CONSTRAINT_MAX_LENGTH_FIELD ", toe);
        }
    }
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyPopUp.java

License:Open Source License

/**
 * Sets the constraint min value field./*  w  w w .j a  v a2 s . c  om*/
 * 
 * @param value the value
 * @return the CreateNewPropertyPopUp
 */
public void setConstraintMinValueField(String value) {
    if (isElementDisplayed(CONSTRAINT_MIN_VALUE_FIELD)) {
        try {
            WebElement field = findAndWait(CONSTRAINT_MIN_VALUE_FIELD);
            field.clear();
            field.sendKeys(value);
        } catch (TimeoutException toe) {
            throw new PageOperationException("Not visible Element: CONSTRAINT_MIN_VALUE_FIELD ", toe);
        }
    }
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyPopUp.java

License:Open Source License

/**
 * Sets the constraint max value field.//  w w w  .j  a va  2 s .c om
 * 
 * @param value the value
 * @return the CreateNewPropertyPopUp
 */
public void setConstraintMaxValueField(String value) {
    if (isElementDisplayed(CONSTRAINT_MAX_VALUE_FIELD)) {
        try {
            WebElement field = findAndWait(CONSTRAINT_MAX_VALUE_FIELD);
            field.clear();
            field.sendKeys(value);
        } catch (TimeoutException toe) {
            throw new PageOperationException("Not visible Element: CONSTRAINT_MAX_VALUE_FIELD ", toe);
        }
    }
}

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

License:Open Source License

/**
 * This method sets the given Search Term into Search Content Configure
 * Search Term box.//from   w  w  w. j  av a2  s. com
 * 
 * @param searchTerm String
 */
public void setSearchTerm(String searchTerm) {
    if (searchTerm == null) {
        throw new IllegalArgumentException("Search Term is required");
    }

    try {
        WebElement searchTermBox = driver.findElement(SEARCH_TERM_BOX);
        searchTermBox.clear();
        searchTermBox.sendKeys(searchTerm);
    } catch (NoSuchElementException te) {
        logger.error("Unable to find the Search Term box.", te);
        throw new PageOperationException("Unable to find the Search Term box.");
    }
}

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

License:Open Source License

/**
 * This method sets the given title into Site Content Configure title box.
 * /* ww w  . j av a 2 s. co m*/
 * @param title String
 */
public void setTitle(String title) {
    if (StringUtils.isEmpty(title)) {
        throw new IllegalArgumentException("Title is required");
    }

    try {
        WebElement titleBox = driver.findElement(TITLE_BOX);
        titleBox.clear();
        titleBox.sendKeys(title);
    } catch (NoSuchElementException te) {
        logger.error("Unable to find the Title box.", te);
        throw new PageOperationException("Unable to find the Title box.");
    }
}

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

License:Open Source License

/**
 * This method sets the given title into Site Content Configure title box.
 *
 * @param title String//from w ww.j  ava  2 s  .  co  m
 */
public void setTitle(String title) {
    if (title == null) {
        throw new IllegalArgumentException("Title is required");
    }

    try {
        WebElement titleBox = findAndWait(TITLE_BOX);
        titleBox.clear();
        titleBox.sendKeys(title);
    } catch (TimeoutException te) {
        logger.error("Unable to find the Title box.", te);
        throw new PageOperationException("Unable to find the Title box.");
    }
}

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

License:Open Source License

/**
 * This method sets the given html code into html source element.
 * /*from   ww w  .  java2  s  .  co  m*/
 * @param htmlSource String
 */
public void setHTMLSource(String htmlSource) {
    if (htmlSource == null) {
        throw new IllegalArgumentException("htmlSource should not be null");
    }

    try {
        WebElement source = findAndWait(HTML_CONTENT_SOURCE);
        source.clear();
        source.sendKeys(htmlSource);
    } catch (TimeoutException te) {
        logger.info("Unable to find the HtmlSource field.", te);
        throw new PageOperationException("Unable to find HtmlSource field.", te);
    }
}

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

License:Open Source License

/**
 * This method sets the given text into Link Url.
 *
 * @param url String/*from  www . j  av a  2  s .c  om*/
 */
public void setImageUrl(String url) {
    if (StringUtils.isEmpty(url)) {
        throw new IllegalArgumentException("Link url value is required");
    }

    try {
        WebElement imageUrlField = findAndWait(IMAGE_URL_CSS);
        imageUrlField.clear();
        imageUrlField.sendKeys(url);
    } catch (TimeoutException te) {
        logger.info("Unable to find the image Url field.", te);
        throw new PageOperationException("Unable to find image Url field.", te);
    }
}