コード例 #1
0
ファイル: WebElementTest.java プロジェクト: sonamM/july_NS
  @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());
  }
コード例 #2
0
ファイル: WebElementTest.java プロジェクト: sonamM/july_NS
  @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());
  }
コード例 #3
0
ファイル: WebElementTest.java プロジェクト: sonamM/july_NS
  @Test
  public void testScrollTopAndBottom() throws PageException {
    // scroll to bottom
    webpage.scrollBottom();

    // find "Amazon Payment Products" element and assert on it.
    ITafElement element = webpage.findObjectByxPath(prop.getProperty("amazon_payment_products"));
    Assert.assertEquals("Amazon Payment Products", element.getText());

    // Scroll to Top
    webpage.scrollTop();

    // find sign in text and assert
    element = webpage.findObjectByxPath(prop.getProperty("amazon_signin_text"));
    Assert.assertEquals("Hello. Sign in", element.getText());
    element.hover();
  }
コード例 #4
0
ファイル: WebElementTest.java プロジェクト: sonamM/july_NS
  @Test
  public void testFullScrollInSlowMotion() throws InterruptedException, PageException {
    // Scroll the web page in slow motion
    webpage.fullScrollInSlowMotion();

    // find the text "Amazon Payment Products"
    ITafElement element = webpage.findObjectByxPath(prop.getProperty("amazon_payment_products"));

    Assert.assertEquals("Amazon Payment Products", element.getText());
  }
コード例 #5
0
ファイル: WebElementTest.java プロジェクト: sonamM/july_NS
  @Test
  public void testScrollToElement() throws PageException {
    // find the element "Amazon.com Rewards Visa Card"
    ITafElement element = webpage.findObjectByxPath(prop.getProperty("amazon_rewards_visa_card"));

    // Scroll to the element
    webpage.scrollToElement(element);

    // Assert and click on it
    Assert.assertEquals("Amazon.com Rewards Visa Card", element.getText());
    element.click();
  }