Пример #1
0
  @Test
  public void testSubmit() throws PageException {
    // Find sign in link
    ITafElement signInElement = webpage.findObjectById(prop.getProperty("amazon_signin_link"));

    // hover and click on it
    signInElement.hover();
    signInElement.click();

    // find email field
    ITafElement element = webpage.findObjectById(prop.getProperty("amazon_email_field"));

    // enter text
    element.sendKeys("Text");

    // find password
    element = webpage.findObjectById(prop.getProperty("amazon_password_field"));

    // enter text
    element.sendKeys("Text");

    // find the sign in button
    element = webpage.findObjectById(prop.getProperty("amazon_signin_submit_button"));

    // submit it
    element.submit();

    // find the warning message
    element = webpage.findObjectByxPath(prop.getProperty("amazon_signin_warning_msg"));
    Assert.assertEquals("Important Message!", element.getText());
  }
Пример #2
0
  @Test
  public void testSendKeys() {
    try {

      // Find sign in button
      ITafElement signInElement = webpage.findObjectById(prop.getProperty("amazon_signin_link"));
      Assert.assertEquals("rgba(0, 102, 192, 1)", signInElement.getCssValue("color"));

      // hover on it
      signInElement.hover();

      // Click on it
      signInElement.click();

      // Find email field
      ITafElement element = webpage.findObjectById(prop.getProperty("amazon_email_field"));

      // enter text
      element.sendKeys("Text");

      Assert.assertEquals("Text", element.getAttribute("value"));
      CommonUtil.sop(element.getAttribute("style"));

      // clear email field
      element.clear();

      Assert.assertEquals("", element.getAttribute("value"));
    } catch (Exception ex) {
      log.error(ex.getMessage());
    }
  }
Пример #3
0
  @Test
  public void testselectDropDownList() throws PageException, InterruptedException {
    // find the search drop down box
    ITafElement dorpdown = webpage.findObjectById(prop.getProperty("amazon_search_dropdown_box"));

    // select "Books" in dropdown
    dorpdown.selectDropDownList("Books");

    // find "Books" element
    ITafElement element =
        webpage.findObjectByxPath(prop.getProperty("amazon_search_dropdown_books"));

    // assert that it is selected
    Assert.assertTrue(element.isSelected());

    // Find the search text box
    element = webpage.findObjectById(prop.getProperty("amazon_search_text_box"));

    // enter "fiction novels"
    element.sendKeys("fiction novels");

    // find search button
    element = webpage.findObjectByxPath(prop.getProperty("amazon_search_submit_button"));

    // submit it
    element.submit();

    // find the text "fiction novels" in the search results
    element = webpage.findObjectByxPath(prop.getProperty("amazon_search_result_text"));

    // Assert on the text
    Assert.assertEquals("\"fiction novels\"", element.getText());
  }