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.search.SearchBox.java

License:Open Source License

/**
 * Performs the live search by typing the term into search field
 * /*from ww  w . j  a  v  a 2  s.  c o  m*/
 * @param term String term to search
 * @return true when actioned
 */
public HtmlPage liveSearch(final String term) {
    if (term == null || term.isEmpty()) {
        throw new UnsupportedOperationException("Search term is required to perform a search");
    }
    try {

        WebElement input = findAndWait(selector);
        input.clear();
        input.sendKeys(term);
        input.click();
        if (logger.isTraceEnabled()) {
            logger.trace("Apply live search on the keyword: " + term);
        }
        return factoryPage.instantiatePage(driver, LiveSearchDropdown.class);
    } catch (TimeoutException nse) {
        throw new PageException("Live search not displayed.");
    }
}

From source file:org.alfresco.po.share.search.SearchResultsPage.java

License:Open Source License

/**
 * Enters the search text and submits the from on basic search page form.
 * /*from  w w  w  . j a  v a  2  s.  c o m*/
 * @param text String search text
 * @return HtmlPage results page object
 */
public HtmlPage doSearch(final String text) {
    WebElement searchField = driver.findElement(By.id(SEARCH_FIELD));
    searchField.clear();
    searchField.sendKeys(text);
    WebElement button = driver.findElement(By.id(SEARCH_BUTTON));
    button.click();

    return factoryPage.instantiatePage(driver, UnknownSharePage.class);
}

From source file:org.alfresco.po.share.search.SearchResultsPage.java

License:Open Source License

/**
 * Performs the search by entering the term into search field
 * and submitting the search form on the result page.
 * /* w w w.  j a  va  2  s .  c  om*/
 * @param term String term to search
 */
protected void searchFor(final String term) {
    if (term == null || term.isEmpty()) {
        throw new UnsupportedOperationException("Search term is required to perform a search");
    }
    WebElement searchInput = driver.findElement(By.cssSelector("input[id$='default-search-text']"));
    searchInput.clear();
    searchInput.sendKeys(term + "\n");
}

From source file:org.alfresco.po.share.site.AddGroupsPage.java

License:Open Source License

/**
 * @param groupDisplayName String//from  ww w .  j a va2  s  . c o m
 * @return AddGroupsPage
 */
public AddGroupsPage searchGroup(String groupDisplayName) {
    if (StringUtils.isEmpty(groupDisplayName)) {
        throw new IllegalArgumentException("Enter value of group Display Name");
    }
    try {
        WebElement input = findAndWait(By.cssSelector(SEARCH_INPUT_TEXT));
        input.clear();
        input.sendKeys(groupDisplayName);
        findAndWait(By.cssSelector(SEARCH_BUTTON)).click();
        waitForElement(By.cssSelector(SEARCH_RESULT_ROW), 2);
        return factoryPage.instantiatePage(driver, AddGroupsPage.class);
    } catch (NoSuchElementException nse) {
        throw new PageOperationException("Not visible Element:" + SEARCH_INPUT_TEXT, nse);
    } catch (TimeoutException toe) {
        throw new PageOperationException("Not visible Element:" + SEARCH_BUTTON, toe);
    }

}

From source file:org.alfresco.po.share.site.AddUsersToSitePage.java

License:Open Source License

/**
 * Enters external user's first name in the input field
 * //from w  w w .j  a va  2 s. c o m
 * @param firstName
 */
public void enterExternalUserFirstName(String firstName) {
    checkNotNull(firstName);
    WebElement inputField = findAndWait(EXTERNAL_FIRST_NAME_INPUT);
    inputField.clear();
    inputField.sendKeys(firstName);
}

From source file:org.alfresco.po.share.site.AddUsersToSitePage.java

License:Open Source License

/**
 * Enters external user's last name in the input field
 * //  ww w .j  a  va 2 s  .  c o  m
 * @param lastName
 */
public void enterExternalUserLastName(String lastName) {
    checkNotNull(lastName);
    WebElement inputField = findAndWait(EXTERNAL_LAST_NAME_INPUT);
    inputField.clear();
    inputField.sendKeys(lastName);
}

From source file:org.alfresco.po.share.site.AddUsersToSitePage.java

License:Open Source License

/**
 * Enters external user's email in the input field
 * //from   w  w  w  . j a  va  2s .c o m
 * @param email
 */
public void enterExternalUserEmail(String email) {
    checkNotNull(email);
    WebElement inputField = findAndWait(EXTERNAL_EMAIL_INPUT);
    inputField.clear();
    inputField.sendKeys(email);

}

From source file:org.alfresco.po.share.site.calendar.AbstractEventForm.java

License:Open Source License

/**
 * Method to set String input in the field
 * /*  w  w  w.  j a v  a 2s  .c  o  m*/
 * @param input
 * @param value
 */

public void setInput(final WebElement input, final String value) {
    try {
        input.clear();
        input.sendKeys(value);
    } catch (NoSuchElementException e) {
        throw new PageException("Unable to find the element");
    }
}

From source file:org.alfresco.po.share.site.contentrule.createrules.CreateRulePage.java

License:Open Source License

private void fillField(By selector, String text) {
    WebElement inputField = findAndWait(selector);
    inputField.clear();
    if (text != null) {
        inputField.sendKeys(text);//from w  w w  .j a  v a2 s .  c  o  m
    }
}

From source file:org.alfresco.po.share.site.CreateSitePage.java

License:Open Source License

protected HtmlPage createSite(final String siteName, final String description, final String siteType) {
    switch (siteType) {
    case SiteType.COLLABORATION:
        WebElement inputSiteName = driver.findElement(INPUT_TITLE);
        inputSiteName.sendKeys(siteName);
        if (description != null) {
            WebElement inputDescription = driver.findElement(INPUT_DESCRIPTION);
            inputDescription.clear();
            inputDescription.sendKeys(description);
        }/*  w  w w  . java 2 s  .c  om*/
        selectSiteType(siteType);
        selectOk();
        waitUntilAlert();

        return factoryPage.getPage(driver);
    default:
        throw new PageOperationException("No site type match found for: " + siteType
                + " out of the following possible options: Collaboration");
    }

}