Пример #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());
  }