Example usage for org.openqa.selenium WebElement sendKeys

List of usage examples for org.openqa.selenium WebElement sendKeys

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement sendKeys.

Prototype

void sendKeys(CharSequence... keysToSend);

Source Link

Document

Use this method to simulate typing into an element, which may set its value.

Usage

From source file:com.ecofactor.qa.automation.insite.page.PartnerManagementImpl.java

License:Open Source License

/**
 * Search By Email.//  w w  w  .j a v a2s.  c  om
 * @param partnerEmail the partner email
 * @see com.ecofactor.qa.automation.insite.page.PartnerManagement#searchByEmail(java.lang.String)
 */
@Override
public void searchByEmail(String partnerEmail) {

    LogUtil.setLogString("Search Partner by Email :" + partnerEmail, true);
    final WebElement textBoxElement = DriverConfig.getDriver()
            .findElement(By.id(partnerConfig.get(PARTNER_EMAIL_FEILD_ID)));
    textBoxElement.sendKeys(partnerEmail);

}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Login consumer portal./*from   w w w.  j a va 2 s .  c  o m*/
 * @param userId the user id
 * @param password the password
 */
public void loginConsumerPortal(String userId, String password) {

    // enter the login credentials
    DriverConfig.setLogString("Check username and password fields", true);
    WebElement userField = DriverConfig.getDriver().findElement(By.id(loginConfig.get(CONSUMER_USER_ID)));
    WebElement passwordField = DriverConfig.getDriver().findElement(By.id(loginConfig.get(CONSUMER_PASSWORD)));
    assertNotNull(userField, "User name field is not available");
    assertNotNull(passwordField, "password field is not available");

    DriverConfig.setLogString("Enter username and password (" + userId + "/" + password + ")", true);
    userField.clear();
    passwordField.clear();

    userField.sendKeys(userId);
    passwordField.sendKeys(password);

    DriverConfig.setLogString("Check Login button, ", true);
    WebElement submitBtn = DriverConfig.getDriver().findElement(By.id(loginConfig.get(CONSUMER_SUBMIT_LOGIN)));
    assertNotNull(submitBtn, "Submit button is not available");

    DriverConfig.setLogString("Click the Login button", true);
    submitBtn.click();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Enter character to electricity rate./*from  www.  j  a v a  2 s .c  o  m*/
 * @param rate the rate
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#enterCharacterToElectricityRate(java.lang.String)
 */
public void enterCharacterToElectricityRate(String rate) {

    DriverConfig.setLogString("Enter Electricity rate as ." + rate, true);
    WebElement electricityRate = DriverConfig.getDriver()
            .findElement(By.id(supportConfig.get(ELECTRICITY_RATE)));
    electricityRate.sendKeys(rate);
    DriverConfig.setLogString("Click ok button", true);
    WebElement btnElement = DriverConfig.getDriver().findElement(By.className(supportConfig.get(OK_BTN)));
    btnElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Enter character to gas rate.//from   www .j a  v a  2  s.  com
 * @param rate the rate
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#enterCharacterToGasRate(java.lang.String)
 */
@Override
public void enterCharacterToGasRate(String rate) {

    DriverConfig.setLogString("Enter Gas rate as ." + rate, true);
    WebElement electricityRate = DriverConfig.getDriver().findElement(By.id(supportConfig.get(GAS_RATE)));
    electricityRate.sendKeys(rate);
    DriverConfig.setLogString("Click ok button", true);
    WebElement btnElement = DriverConfig.getDriver().findElement(By.className(supportConfig.get(OK_BTN)));
    btnElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Enter phone number.//from   w w  w.  java 2  s . com
 * @param phoneNumber the phone number
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#enterPhoneNumber(java.lang.String)
 */
@Override
public void enterPhoneNumber(String phoneNumber) {

    DriverConfig.setLogString("Enter Phone Number as ." + phoneNumber, true);
    WebElement phoneNumberElement = DriverConfig.getDriver()
            .findElement(By.id(supportConfig.get(PHONE_NUMBER)));
    phoneNumberElement.clear();
    phoneNumberElement.sendKeys(phoneNumber);
    clickOkBtn();
    closePopup();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * Enter email id./*from  www  . java2s.c  o m*/
 * @param email the email
 * @see com.ecofactor.qa.automation.insite.page.SupportLookUp#enterEmailId(java.lang.String)
 */
@Override
public void enterEmailId(String email) {

    DriverConfig.setLogString("Enter Email Id as ." + email, true);
    WebElement emailElement = DriverConfig.getDriver().findElement(By.id(supportConfig.get(Email_ID)));
    emailElement.clear();
    emailElement.sendKeys(email);
    clickOkBtn();
    closePopup();
}

From source file:com.ecofactor.qa.automation.insite.page.SupportLookUpImpl.java

License:Open Source License

/**
 * search by emial address./*www .  ja v a 2 s.  c  om*/
 * @param address the address
 */
public void searchByAddress(String address) {

    DriverConfig.setLogString("Enter address as " + address, true);
    WebElement addressElement = DriverConfig.getDriver().findElement(By.id("address"));
    addressElement.sendKeys(address);
    tinyWait();

    WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(), TAG_INPUT,
            ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java

License:Open Source License

/**
 * Search by name./*  w  ww . j av a  2s  . c  om*/
 * @param name the name
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#searchByName(java.lang.String)
 */
public void searchByName(final String name) {

    DriverConfig.setLogString("Search user by name.", true);
    final WebElement textBoxElement = DriverConfig.getDriver().findElement(By.id("fusername"));
    textBoxElement.sendKeys(name);
    DriverConfig.setLogString("Enter username in search text box: " + name, true);

    final WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(),
            TAG_INPUT, ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java

License:Open Source License

/**
 * Search by email.//from   w  w w .ja v  a2s.c  om
 * @param emailId the email id
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#searchByEmail(java.lang.String)
 */
public void searchByEmail(final String emailId) {

    DriverConfig.setLogString("Search user by email.", true);
    final WebElement textBoxElement = DriverConfig.getDriver().findElement(By.id("findemail"));
    textBoxElement.sendKeys(emailId);
    DriverConfig.setLogString("Enter email id in search text box: " + emailId, true);
    final WebElement buttonElement = retrieveElementByContainsOfAttributeValue(DriverConfig.getDriver(),
            TAG_INPUT, ATTR_VALUE, "Find", MEDIUM_TIMEOUT);
    buttonElement.click();
}

From source file:com.ecofactor.qa.automation.insite.page.UserManagementImpl.java

License:Open Source License

/**
 * Edits the first name./*from   w w w  . j av  a 2 s.  c  o  m*/
 * @param firstName the first name
 * @see com.ecofactor.qa.automation.insite.page.UserManagement#editFirstName()
 */
@Override
public void editFirstName(final String firstName) {

    DriverConfig.setLogString("Edit First Name.", true);
    if (firstName != null && !firstName.isEmpty()) {
        final WebElement firstNameElemt = DriverConfig.getDriver()
                .findElement(By.id(userConfig.get(FIRST_NAME)));
        firstNameElemt.clear();
        DriverConfig.setLogString("Enter Firstname: " + firstName, true);
        firstNameElemt.sendKeys(firstName);
    }
}