Package org.openqa.selenium

Examples of org.openqa.selenium.WebElement.sendKeys()


  // @Ignore(OPERA_MOBILE)
  public void testShouldBeAbleToEnterTextIntoATextAreaBySettingItsValue() {
    driver.get(pages.javascriptPage);
    WebElement textarea = driver.findElement(By.id("keyUpArea"));
    String cheesy = "brie and cheddar";
    textarea.sendKeys(cheesy);
    assertEquals(textarea.getAttribute("value"), cheesy);
    assertEquals(driver.findElement(By.id("result")).getText(), cheesy);
  }

  // @Ignore(value = { ANDROID, OPERA_MOBILE }, reason =
View Full Code Here


  @Test
  public void testSendKeysKeepsCapitalization() throws InterruptedException {
    driver.get(pages.javascriptPage);
    WebElement textarea = driver.findElement(By.id("keyUpArea"));
    String cheesey = "BrIe And CheDdar";
    textarea.sendKeys(cheesey);
    assertEquals(textarea.getAttribute("value"), (cheesey));
  }

  // @Ignore(value = { SELENESE, IPHONE, ANDROID, OPERA_MOBILE })
  @Test(enabled = false)
View Full Code Here

  @Test(enabled = false)
  public void testShouldSubmitAFormUsingTheNewlineLiteral() {
    driver.get(pages.formPage);
    WebElement nestedForm = driver.findElement(By.id("nested_form"));
    WebElement input = nestedForm.findElement(By.name("x"));
    input.sendKeys("\n");
    waitFor(pageTitleToBe(driver, "We Arrive Here"));
    assertTrue(driver.getCurrentUrl().endsWith("?x=name"));
  }

  // @Ignore({ SELENESE, IPHONE, ANDROID, OPERA_MOBILE })
View Full Code Here

  @Test(enabled = false)
  public void testShouldSubmitAFormUsingTheEnterKey() {
    driver.get(pages.formPage);
    WebElement nestedForm = driver.findElement(By.id("nested_form"));
    WebElement input = nestedForm.findElement(By.name("x"));
    input.sendKeys(Keys.ENTER);
    waitFor(pageTitleToBe(driver, "We Arrive Here"));
    assertTrue(driver.getCurrentUrl().endsWith("?x=name"));
  }

  @Test
View Full Code Here

        driver.findElement(By.xpath("//form[@name='someForm']/input[@id='username']"));
    String originalValue = element.getAttribute("value");
    assertEquals(originalValue, ("change"));

    element.clear();
    element.sendKeys("some text");

    element = driver.findElement(By.xpath("//form[@name='someForm']/input[@id='username']"));
    String newFormValue = element.getAttribute("value");
    assertEquals(newFormValue, ("some text"));
  }
View Full Code Here

    assertEquals(uploadElement.getAttribute("value"), (""));

    File file = File.createTempFile("test", "txt");
    file.deleteOnExit();

    uploadElement.sendKeys(file.getAbsolutePath());

    String uploadPath = uploadElement.getAttribute("value");
    assertTrue(uploadPath.endsWith(file.getName()));
  }
View Full Code Here

    assertEquals(uploadElement.getAttribute("value"), (""));

    File file = File.createTempFile("test", "txt");
    file.deleteOnExit();

    uploadElement.sendKeys(file.getAbsolutePath());

    String uploadPath = uploadElement.getAttribute("value");
    assertTrue(uploadPath.endsWith(file.getName()));
  }
View Full Code Here

    driver.get(pages.formPage);
    WebElement uploadElement = driver.findElement(By.id("upload"));
    assertEquals(uploadElement.getAttribute("value"), (""));

    uploadElement.sendKeys(file.getAbsolutePath());
    uploadElement.submit();

    driver.get(pages.formPage);
    uploadElement = driver.findElement(By.id("upload"));
    assertEquals(uploadElement.getAttribute("value"), (""));
View Full Code Here

    driver.get(pages.formPage);
    uploadElement = driver.findElement(By.id("upload"));
    assertEquals(uploadElement.getAttribute("value"), (""));

    uploadElement.sendKeys(file.getAbsolutePath());
    uploadElement.submit();

    // If we get this far, then we're all good.
  }
View Full Code Here

  // doesn't work if the text is longer than the input size, as the cursor will
  // end up where the tap was done.
  public void testSendingKeyboardEventsShouldAppendTextInInputs() {
    driver.get(pages.formPage);
    WebElement element = driver.findElement(By.id("working"));
    element.sendKeys("some");
    String value = element.getAttribute("value");
    assertEquals(value, ("some"));

    element.sendKeys(" text");
    value = element.getAttribute("value");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.