Example usage for org.openqa.selenium By name

List of usage examples for org.openqa.selenium By name

Introduction

In this page you can find the example usage for org.openqa.selenium By name.

Prototype

public static By name(String name) 

Source Link

Usage

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterCarIdentifyNum(String carIdentifyNum) {
    WebElement carIdentifyNumInput = driver.findElement(By.name("carIdentifyNum"));
    carIdentifyNumInput.clear();//from   w  ww  . java  2 s  .  co m
    carIdentifyNumInput.sendKeys(carIdentifyNum);
}

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterCommercialInsuranceDate(String commercialInsuranceDate) {
    WebElement commercialInsuranceDateInput = driver.findElement(By.name("commercialInsuranceExpiredDate"));
    commercialInsuranceDateInput.clear();
    commercialInsuranceDateInput.sendKeys(commercialInsuranceDate);
    commercialInsuranceDateInput.click();
}

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterCompulsoryInsuranceDate(String compulsoryInsuranceDate) {
    WebElement compulsoryInsuranceDateInput = driver
            .findElement(By.name("trafficCompulsoryInsuranceExpiredDate"));
    compulsoryInsuranceDateInput.clear();
    compulsoryInsuranceDateInput.sendKeys(compulsoryInsuranceDate);
    compulsoryInsuranceDateInput.click();
}

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterNewCarPrice(String newCarPrice) {
    WebElement newCarPriceInput = driver.findElement(By.name("newCarPrice"));
    newCarPriceInput.clear();/* w ww.jav a2  s  .co  m*/
    newCarPriceInput.sendKeys(newCarPrice);
}

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterSecondHandCarPrice(String secondHandCarPrice) {
    WebElement secondHandCarPriceInput = driver.findElement(By.name("secondHandCarPrice"));
    secondHandCarPriceInput.clear();//  w  ww .j  a va 2s  . c  om
    secondHandCarPriceInput.sendKeys(secondHandCarPrice);
}

From source file:cls.ui.model.selenium.secondhandcarmanagement.StartAssessmentPage.java

public void enterComment(String comment) {
    WebElement commentInput = driver.findElement(By.name("memo"));
    commentInput.clear();
    commentInput.sendKeys(comment);
}

From source file:cn.aozhi.songify.functional.BaseSeleniumTestCase.java

License:Apache License

/**
 * ?, ./*from  w  ww . j a  v  a2  s .co  m*/
 */
protected static void loginAsUserIfNecessary() {
    s.open("/task");

    if (s.getTitle().contains("")) {
        s.type(By.name("username"), "user");
        s.type(By.name("password"), "user");
        s.check(By.name("rememberMe"));
        s.click(By.id("submit_btn"));
        s.waitForTitleContains("?");
    }
}

From source file:cn.aozhi.songify.functional.gui.RegisterFT.java

License:Apache License

@Test
public void register() {
    // //w  ww . j ava  2  s .  co  m
    s.open("/logout");
    s.click(By.linkText(""));

    s.type(By.id("loginName"), "user2");
    s.type(By.id("name"), "Kevin");
    s.type(By.id("plainPassword"), "user2");
    s.type(By.id("confirmPassword"), "user2");

    s.click(By.id("submit_btn"));

    // 
    s.waitForTitleContains("");
    assertThat(s.getValue(By.name("username"))).isEqualTo("user2");

    s.type(By.name("password"), "user2");
    s.click(By.id("submit_btn"));

    // ?
    s.waitForTitleContains("?");

    // 
    s.open("/logout");
}

From source file:cn.aozhi.songify.functional.gui.SecurityFT.java

License:Apache License

/**
 * ???.//w w w.j av  a2  s. co m
 */
@Test
public void loginWithWrongPassword() {
    s.open("/logout");
    s.type(By.name("username"), "wrongUser");
    s.type(By.name("password"), "WrongPassword");
    s.check(By.name("rememberMe"));
    s.click(By.id("submit_btn"));

    s.waitForTitleContains("");
    assertThat(s.isTextPresent("?.")).isTrue();
}

From source file:cn.aozhi.songify.functional.gui.TaskGuiFT.java

License:Apache License

/**
 * //?/.//  w w w . ja  v  a  2 s .  c  o m
 */
@Test
@Category(Smoke.class)
public void crudTask() {
    s.open("/task/");

    // create
    s.click(By.linkText(""));

    Task task = TaskData.randomTask();
    s.type(By.id("task_title"), task.getTitle());
    s.click(By.id("submit_btn"));

    assertThat(s.isTextPresent("?")).isTrue();

    // update
    s.click(By.linkText(task.getTitle()));
    assertThat(s.getValue(By.id("task_title"))).isEqualTo(task.getTitle());

    String newTitle = TaskData.randomTitle();
    s.type(By.id("task_title"), newTitle);
    s.click(By.id("submit_btn"));
    assertThat(s.isTextPresent("?")).isTrue();

    // search
    s.type(By.name("search_LIKE_title"), newTitle);
    s.click(By.id("search_btn"));
    assertThat(s.getTable(By.id("contentTable"), 0, 0)).isEqualTo(newTitle);

    // delete
    s.click(By.linkText(""));
    assertThat(s.isTextPresent("?")).as("??").isTrue();
}