Exemplo n.º 1
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());
    }
  }
Exemplo n.º 2
0
  @Test
  public void testDoubleClick() {
    try {
      // find sign in link
      ITafElement element = webpage.findObjectById(prop.getProperty("amazon_signin_link"));

      // assert on css value
      Assert.assertEquals("rgba(0, 102, 192, 1)", element.getCssValue("color"));

      // double click on signin link
      element.doubleClick();
      ;

      // Assert on Sign in text
      String text = webpage.findObjectById(prop.getProperty("amazon_signin_title")).getText();
      Assert.assertEquals(text, "Sign In");
    } catch (Exception ex) {
      log.error(ex.getMessage());
    }
  }
Exemplo n.º 3
0
  @Test
  public void testClick() {
    try {
      // Find sign in button
      ITafElement element = webpage.findObjectById(prop.getProperty("amazon_signin_link"));
      Assert.assertEquals("rgba(0, 102, 192, 1)", element.getCssValue("color"));

      // hover on it
      element.hover();

      // Click on it
      element.click();

      // find the sign in element
      String text = webpage.findObjectById(prop.getProperty("amazon_signin_title")).getText();

      Assert.assertEquals(text, "Sign In");
    } catch (Exception ex) {
      log.error(ex.getMessage());
    }
  }