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.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void clearField(String locator) {
    WebElement j2c = findElement(locator);
    j2c.clear();
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void type(String locator, String value) {
    WebElement we = findElement(locator);
    try {/* w  w w  . j a va2  s  .c o m*/
        we.click();
    } catch (Exception e) {
    }
    we.clear();
    we.sendKeys(value);
}

From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Performs a clear action on the Webelement.
 * /*from   ww w  .j a v  a2  s . c  om*/
 * @param element
 *            the element
 */
public static void clear(WebElement element) {
    SeleniumUtilities.waitForElement(element);
    element.clear();
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * method to clear element and enter text.
 *
 * @param elements/*w w  w  .j  a v a  2  s .c o  m*/
 *            (web element to clear)
 * @param text
 *            (value to send)
 */
public void clearAndType(final WebElement elements, final String text) {
    elements.clear();
    elements.sendKeys(text);
}

From source file:com.coderoad.automation.common.util.old.BasePage.java

License:Open Source License

/**
 * this method sets the text in the webelement.
 * /*  ww  w  .j av  a 2s. c  o  m*/
 * @param fieldName the field name
 * @param value the value
 */
protected void setText(WebElement fieldName, String value) {

    clearText(fieldName);
    fieldName.clear();
    if (value != null) {
        fieldName.sendKeys(value);
    }
}

From source file:com.coderoad.automation.common.util.PageUtil.java

License:Open Source License

/**
 * Clear and set text.//from ww w.j a  va2s.  c om
 * 
 * @param driver the driver
 * @param locator the locator
 * @param innerText the inner text
 * @param timeout the timeout
 */
public static void clearAndSetText(final WebDriver driver, final By locator, final String innerText,
        final Timeout timeout) {

    final WebElement element = getElement(driver, locator, timeout);
    Assert.assertNotNull(element, "Element cannot be null");
    element.clear();
    element.sendKeys(innerText);
    element.sendKeys(Keys.ENTER);
    WaitUtil.waitUntil(Timeout.ATOMIC_TIMEOUT);
}

From source file:com.coderoad.automation.common.util.PageUtil.java

License:Open Source License

/**
 * Clear and set text press enter.//from   w w w.  j ava2s  . c  om
 * 
 * @param driver the driver
 * @param locator the locator
 * @param innerText the inner text
 * @param timeout the timeout
 */
public static void clearAndSetTextPressEnter(final WebDriver driver, final By locator, final String innerText,
        final Timeout timeout) {

    final WebElement element = getElement(driver, locator, timeout);
    element.clear();
    element.sendKeys(innerText);
    element.sendKeys(Keys.ENTER);
}

From source file:com.coderoad.automation.common.util.PageUtil.java

License:Open Source License

/**
 * Clear text.//from www .  ja va 2 s. c o  m
 * 
 * @param driver the driver
 * @param locator the locator
 * @param timeout the timeout
 */
public static void clearText(final WebDriver driver, final By locator, final Timeout timeout) {

    final WebElement element = getElement(driver, locator, timeout);
    element.clear();
    element.sendKeys(Keys.ENTER);
}

From source file:com.coderoad.automation.rocketTruedx.RocketTruedxNaBasePage.java

License:Open Source License

/**
 * Verify phone number validation./*w w w  . j a  va2s.  c o m*/
 * 
 * @param xpathInputPhoneNumber the xpath input phone number
 * @param phone the phone
 * @param typeValidation the type validation
 */
public void verifyPhoneNumberValidation(String xpathInputPhoneNumber, String phone, String typeValidation) {

    WaitUtil.waitUntil(3);
    WebElement element = driver.findElement(By.xpath(xpathInputPhoneNumber));
    element.clear();
    element.sendKeys(phone);
    element = driver.findElement(By.xpath(xpathInputPhoneNumber));
    Assert.assertTrue(
            element.getAttribute("aria-invalid").contains(typeValidation.equals("1") ? "false" : "true"),
            "The validation does not function correctly.");
    LogUtil.log("The validation functions correctly.", LogLevel.LOW);
}

From source file:com.cognifide.aet.sanity.functional.cucumber.FilteringSteps.java

License:Apache License

@When("^I search for tests containing \"([^\"]*)\"$")
public void iSearchForTestsContaining(final String searchedTerm) throws Throwable {
    Aside aside = reportHomePage.getAside();
    final WebElement searchInput = aside.getSearchInput();

    // retries typing as there is known bug in selenium:
    // https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4446
    bobcatWait.withTimeout(Timeouts.MEDIUM).until(new ExpectedCondition<Boolean>() {

        @Nullable//from  w w  w. j  ava2 s. c o m
        @Override
        public Boolean apply(@Nullable WebDriver input) {
            searchInput.clear();
            searchInput.sendKeys(searchedTerm);
            return searchInput.getAttribute("value").equals(searchedTerm);
        }
    });
}