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.task.EditTaskPage.java

License:Open Source License

/**
 * Enter comment//from   w  ww.  j a v a2s  .  c om
 * 
 * @param comment String
 */
public void enterComment(String comment) {
    try {
        WebElement commentBox = driver.findElement(By.cssSelector(COMMENT_TEXTAREA));
        commentBox.clear();
        commentBox.sendKeys(comment);
    } catch (NoSuchElementException e) {
        throw new UnsupportedOperationException("Comment cannot be added for this task", e);
    }
}

From source file:org.alfresco.po.share.user.TrashCanPage.java

License:Open Source License

/**
 * Input serach text and perform search with in the items which are displayed in the trashcan page.
 *
 * @param searchText String// w w w.j ava 2 s .c o  m
 * @return - TrashCanPage as response
 */
public HtmlPage itemSearch(String searchText) {
    WebElement inputField = driver.findElement(TRASHCAN_SEARCH_INPUT);
    inputField.clear();
    inputField.sendKeys(searchText);
    driver.findElement(TRASHCAN_SEARCH_BUTTON).click();
    waitUntilElementDisappears(PAGE_LOADING, 1);
    return getCurrentPage();
}

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

License:Open Source License

/**
 * Completes the search form on the user
 * finders page./*from w  ww.  j a va  2s  . c  om*/
 * 
 * @param user String name
 * @return UserSearchPage page response
 */
public HtmlPage searchFor(final String user) {
    // Null check
    if (user == null) {
        throw new UnsupportedOperationException("user name is required");
    }

    WebElement input = findAndWait(By.cssSelector(USER_SEARCH_BOX));
    input.clear();
    input.sendKeys(user);
    WebElement button = findAndWait(By.cssSelector(USER_SEARCH_BUTTON));
    button.click();
    return getCurrentPage();
}

From source file:org.alfresco.po.share.workflow.NewWorkflowPage.java

License:Open Source License

/**
 * Method to fill up all static details on the current Workflow form page object
 *
 * @param formDetails WorkFlowFormDetails
 *//*from  w w  w.  ja v a  2s.  c  o m*/
public void fillUpWorkflowForm(WorkFlowFormDetails formDetails) {
    if (formDetails == null || StringUtils.isEmpty(formDetails.getMessage())
            || formDetails.getReviewers().size() < 1 || isReviewersBlank(formDetails.getReviewers())) {
        throw new UnsupportedOperationException("siteName or message or cloudUsers cannot be blank");
    }
    enterMessageText(formDetails.getMessage());
    if (formDetails.getDueDate() != null) {
        enterDueDateText(formDetails.getDueDate());
    }
    if (formDetails.getTaskPriority() != null) {
        selectPriorityDropDown(formDetails.getTaskPriority());
    }
    if (formDetails.getApprovalPercentage() != 0) {
        WebElement approvalElem = findAndWait(REQUIRED_APPROVAL);
        approvalElem.clear();
        approvalElem.sendKeys(String.valueOf(formDetails.getApprovalPercentage()));
    }
}

From source file:org.alfresco.po.share.workflow.WorkFlowPage.java

License:Open Source License

/**
 * @param date//www. j a v  a  2s.  c o  m
 *            - The message that should be entered in message box
 */
@Override
public void enterDueDateText(String date) {
    if (StringUtils.isEmpty(date)) {
        throw new IllegalArgumentException("Date cannot be Empty or null");
    }
    WebElement workFlowDescription = getDueDateElement();
    workFlowDescription.clear();
    workFlowDescription.sendKeys(date);
}

From source file:org.alfresco.po.thirdparty.wordpress.WordPressUserPage.java

License:Open Source License

private WordPressUserPage search(String text) {
    try {// w w w.jav  a  2  s  .  c o m
        WebElement inputElement = findAndWait(SEARCH_INPUT);
        inputElement.clear();
        inputElement.sendKeys(text);
        findAndWait(SEARCH_SUBMIT).click();

    } catch (TimeoutException e) {
        logger.error("Not able to search ", e);
    }
    return factoryPage.instantiatePage(driver, WordPressUserPage.class).render();
}

From source file:org.apache.falcon.regression.ui.search.AbstractSearchPage.java

License:Apache License

public static void clearAndSet(WebElement webElement, String val) {
    webElement.clear();
    webElement.sendKeys(val);
}

From source file:org.apache.falcon.regression.ui.search.AbstractSearchPage.java

License:Apache License

public static void clearAndSetSlowly(WebElement webElement, String val) {
    webElement.clear();
    sendKeysSlowly(webElement, val);
}

From source file:org.apache.falcon.regression.ui.search.ClusterWizardPage.java

License:Apache License

/**
 * Methods to fill specific wizard fields.
 *//*from   w ww .j ava 2s .  c o  m*/
public void setName(String name) {
    WebElement nameInput = getNameInput();
    nameInput.clear();
    sendKeysSlowly(nameInput, name);
}

From source file:org.apache.falcon.regression.ui.search.ClusterWizardPage.java

License:Apache License

public void setColo(String colo) {
    WebElement coloInput = clusterBox.findElement(By.xpath("//div[label[text()='Colo']]/input"));
    coloInput.clear();
    sendKeysSlowly(coloInput, colo);//  w w  w  . j  a  v a2s . c om
}