Ejemplo n.º 1
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());
  }
Ejemplo n.º 2
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());
  }