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.moodle.testmanager.pageObjectModel.ForumSplit.java

License:GNU General Public License

/**
 * Enters a discussion name.//from ww  w  . ja  v  a2s .c  o  m
 * @param name The desired name of the discussion to be passed from the test.
 */
public void enterDiscussionName(String name) {
    WebElement discussionName = driver.findElement(
            By.xpath(".//tr[contains(.,'" + this.properties.get("fieldLabel") + "')]/*/input[@type='text']"));
    discussionName.clear();
    discussionName.sendKeys(name);
}

From source file:com.moodle.testmanager.pageObjectModel.Installation.java

License:GNU General Public License

public void enterFullSiteName(String siteFullName) {
    WebElement fullName = driver.findElement(By.id("id_s__fullname"));
    fullName.sendKeys(siteFullName);
}

From source file:com.moodle.testmanager.pageObjectModel.QuizAddForm.java

License:GNU General Public License

/**
 * Generic text entry field for this class.
 * @param fieldLocator The locator value for field. Allways ID in this form.
 * @param valueToEnter The value that you would like to enter in the text field.
 *//*  w w w.  j a va 2 s . c o m*/
private void textFieldQuiz(String fieldLocator, CharSequence valueToEnter) {
    WebElement textField = driver.findElementById(fieldLocator);
    textField.sendKeys(valueToEnter);
}

From source file:com.moodle.testmanager.pageObjectModel.Users.java

License:GNU General Public License

/**
 * Enter a username//from  ww w .j av a 2s  .c o m
 * @param user The user username passed from the test.
 */
public void enterUsername(String user) {
    WebElement username = driver.findElement(By.id("username"));
    username.sendKeys(user);
}

From source file:com.moodle.testmanager.pageObjectModel.Users.java

License:GNU General Public License

/**
 * Enter a password/*w  w w.j  a  va 2 s. c o m*/
 * @param userPassword The password. This is passed from the test.
 */
public void enterPassword(String userPassword) {
    WebElement password = driver.findElement(By.id("password"));
    password.sendKeys(userPassword);
}

From source file:com.moodle.testmanager.pageObjectModel.Users.java

License:GNU General Public License

/**
 * Logs a given user into the system. calling this method avoids repeating code.
 * @param uname The Username of the user you want to log into Moodle. Pass this value from the test.
 * @param userPassword The password of the user that you want to log into the system. Pass this value from the test.
 *//*from w  w  w .  j  a  v a  2s . com*/
public void loginToSystem(String uname, String userPassword) {
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    WebElement login;
    login = driver.findElement(By.partialLinkText(this.properties.get("loginLink")));
    login.click();
    WebElement username = driver.findElement(By.id("username"));
    username.sendKeys(uname);
    WebElement password = driver.findElement(By.id("password"));
    password.sendKeys(userPassword);
    driver.findElement(By.id("loginbtn")).click();
}

From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java

License:GNU General Public License

/**
 * Enter a value in the username field where the value is specified in the test.
 * @param username The desired username, this value is passed from the test.
 *//*  www.ja  va  2s  .  c  o m*/
public void enterUsername(String username) {
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    WebElement usernameField = driver.findElementById("id_username");
    usernameField.sendKeys(username);
}

From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java

License:GNU General Public License

/**
 * Enter a value in the password field where the value is specified in the test.
 * @param newPassword The desired password, this value is passed from the test.
 */// w  ww  .  j a  v  a 2 s .c o m
public void enterPassword(String newPassword) {
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    WebElement newPasswordField = driver.findElement(By.cssSelector("#id_newpassword"));
    newPasswordField.sendKeys(newPassword);
}

From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java

License:GNU General Public License

/**
 * Enter a value in the first name field where the value is specified in the test.
 * @param firstName The desired firstname, this value is passed from the test.
 *//*  w w w. ja v  a  2 s.c o m*/
public void enterFirstName(String firstName) {
    WebElement firstNameField = driver.findElement(By.cssSelector("#id_firstname"));
    firstNameField.sendKeys(firstName);
}

From source file:com.moodle.testmanager.pageObjectModel.UsersAddNewUser.java

License:GNU General Public License

/**
 * Enter a value in the surname field where the value is specified in the test.
 * @param surname The desired surname, this value is passed from the test.
 *//*from   w  w w .j  ava2  s  .co  m*/
public void enterSurname(String surname) {
    WebElement surnameField = driver.findElement(By.cssSelector("#id_lastname"));
    surnameField.sendKeys(surname);
}