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:com.digi.selenium.util.PageNavigation.java

/**
 * Handle input Textfield['Text'] on page by element ID
 * pass the input data /* w w  w .j a va2  s  . co m*/
 * @param Wedriver localWebDeriver  
 * @param String elementID
 * @param String inputData
 */

protected void handleClearInputField_ByName(String elementID) {
    try {
        getDriver().findElement(By.name(elementID)).clear();
    } catch (Exception e) {
        //System.out.println("Fail : Element ID '" + elementID + " Not Found");
        log.error("Fail : Element ID '" + elementID + " Not Found");
        //e.printStackTrace();
        //System.exit(0);
    }
}

From source file:com.digi.selenium.util.PageNavigation.java

/**
 * Handle input Textfield['Text'] on page by element Name
 * pass the input data //from www .ja v  a  2  s. com
 * @param Wedriver localWebDeriver  
 * @param String elementID
 * @param String inputData
 */

protected void handleInputField_ByName(String elementName, String inputData) {
    try {
        getDriver().findElement(By.name(elementName)).sendKeys(inputData);
    } catch (Exception e) {
        //System.out.println("Fail : Element '" + elementName + " Not Found");
        log.error("Fail : Element '" + elementName + " Not Found");
        //e.printStackTrace();
        //System.exit(0);
    }
}

From source file:com.dukescript.api.selenium.FindsByTest.java

License:Open Source License

@Test
public void findElementByName() {
    WebElement element = driver.findElement(By.name("text"));
    Assert.assertEquals("INPUT", element.getTagName());
}

From source file:com.dukescript.api.selenium.FindsByTest.java

License:Open Source License

@Test
public void Element_findElementByName() {
    WebElement parent = driver.findElement(By.id("form"));
    WebElement element = parent.findElement(By.name("text"));
    Assert.assertEquals("INPUT", element.getTagName());
}

From source file:com.dukescript.api.selenium.FindsByTest.java

License:Open Source License

@Test
public void findElementsByName() {
    List<WebElement> found = driver.findElements(By.name("text"));
    Assert.assertEquals(1, found.size());
}

From source file:com.dukescript.api.selenium.FindsByTest.java

License:Open Source License

@Test
public void Element_findElementsByName() {
    WebElement parent = driver.findElement(By.id("form"));
    List<WebElement> found = parent.findElements(By.name("text"));
    Assert.assertEquals(1, found.size());
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansQuestSteps.java

@Given("^User should be login to the lab$")
public void user_should_be_login_to_the_lab() throws Throwable {
    driver.navigate().to(URL);/*from w w  w . ja v  a 2s  . c o m*/

    WebElement username = driver.findElement(By.name(FIND_USERNAME));
    username.clear();
    username.sendKeys(USERNAME);

    WebElement psw = driver.findElement(By.name(FIND_PASSWORD));
    psw.clear();
    psw.sendKeys(PASSWORD);

    driver.findElement(By.xpath("//*[@id=\"loginform\"]/div[3]/div/button")).click();
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansQuestSteps.java

@When("^Enter Username as 'Angelia' and pwd as 'Welcome@(\\d+)'$")
public void enter_Username_as_Angelia_and_pwd_as_Welcome(int arg1) throws Throwable {
    String username = "Angelia";
    driver.findElement(By.name(FIND_PHYSICIAN_USERNAME)).sendKeys(username);
    driver.findElement(By.name(FIND_PHYSICIAN_PASSWORD)).sendKeys(CLINICIAN_PSW);
    Thread.sleep(5000);/* www.j  a  v a2 s  .c  om*/
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansQuestSteps.java

@When("^Enter the remaining information and click on 'Submit'$")
public void enter_the_remaining_information_and_click_on_Submit() throws Throwable {
    Physician physician = initailizePhysician();
    driver.findElement(By.name("user.firstName")).sendKeys(physician.getFirstName());
    driver.findElement(By.name("user.middleIntial")).sendKeys(physician.getMiddleName());
    driver.findElement(By.name("user.lastName")).sendKeys(physician.getLastName());
    driver.findElement(By.name("user.medicalDegree")).sendKeys(physician.getMedicalDegree());
    driver.findElement(By.name("user.contact")).sendKeys(physician.getPhoneNumber());
    driver.findElement(By.name("user.email")).sendKeys(physician.getEmail());
    driver.findElement(By.name("salutation")).sendKeys(physician.getSalutation());
    driver.findElement(By.name("medicare_num")).sendKeys(physician.getMedicalNumber());
    driver.findElement(By.name("medicaid_num")).sendKeys(physician.getMedicaidNumber());
    driver.findElement(By.name("upin_num")).sendKeys(physician.getUpinNumer());
    driver.findElement(By.name("state_license")).sendKeys(physician.getStateLicence());
    driver.findElement(By.name("npi")).sendKeys(physician.getNpi());

    Thread.sleep(2000);/* w w  w  .  j  a v  a2 s.  c o  m*/

    driver.findElement(By.cssSelector(".btn.btn-primary.btn-md")).click();
    Thread.sleep(2000);
}

From source file:com.easytox.automation.steps.addPhysicians.AddPhysiciansQuestSteps.java

@When("^Enter Username as 'Anaron' and pwd as 'Welcome@(\\d+)'$")
public void enter_Username_as_Anaron_and_pwd_as_Welcome(int arg1) throws Throwable {
    String username = "Anaron";
    driver.findElement(By.name(FIND_PHYSICIAN_USERNAME)).sendKeys(username);
    driver.findElement(By.name(FIND_PHYSICIAN_PASSWORD)).sendKeys(CLINICIAN_PSW);
    Thread.sleep(5000);/*from  ww w.j  a  v a 2  s  . c o m*/
}