Exemplo n.º 1
0
 public void readonly() {
   String x = selenWebElement.getAttribute("readonly");
   if (x == null) {
     Assertion.test(expect, false, "readonly");
   } else if (x.equals("true")) {
     Assertion.test(expect, true, "readonly");
   }
 }
Exemplo n.º 2
0
 public void haveStyle(String styleProperty, String styleValue) {
   String val = selenWebElement.getCssValue(styleProperty);
   Assertion.test(
       expect,
       styleValue.toLowerCase(),
       val.toLowerCase(),
       "Test for css Style property matching");
 }
Exemplo n.º 3
0
 public void haveAttr(String attrName) {
   try {
     selenWebElement.getAttribute(attrName);
     Assertion.test(expect, true, "Test for Attribute availability");
   } catch (Exception e) {
     Assertion.test(expect, false, "Test for Attribute availability");
   }
 }
Exemplo n.º 4
0
 public void focused() {
   WebElement elm = (WebElement) driver.executeScript("return document.activeElement");
   if (elm != null && elm.equals(selenWebElement.getWebElement())) {
     Assertion.test(expect, true, "Test for elment foucsed");
   } else {
     Assertion.test(expect, false, "Test for elment foucsed");
   }
 }
Exemplo n.º 5
0
 public void disabled() {
   String x = selenWebElement.getAttribute("disabled");
   if (x == null) {
     Assertion.test(expect, false, "disabled");
   } else if (x.equals("true")) {
     Assertion.test(expect, true, "disabled");
   }
 }
Exemplo n.º 6
0
 public void haveAttrVal(String attrName, String attrValue, boolean caseSensitive) {
   String attibValue = selenWebElement.getAttribute(attrName);
   if (!caseSensitive) {
     Assertion.test(
         expect, attrValue.toLowerCase(), attibValue.toLowerCase(), "Have Attribute value");
   } else {
     Assertion.test(expect, attrValue, attibValue, "Have Attribute value");
   }
 }
Exemplo n.º 7
0
  public void haveText(String regex, boolean caseSensitive) {
    String txt = selenWebElement.getText();
    if (!caseSensitive) {
      regex = regex.toLowerCase();
      txt = txt.toLowerCase();
    }

    boolean res = Assertion.test(expect, txt.matches(regex), "Test for Text matching");
    if (!res) {
      Assertion.printDetails(expect, regex, txt);
    }
  }
Exemplo n.º 8
0
 public void displayed() {
   Assertion.test(expect, selenWebElement.isDisplayed(), "Test for elment displying");
 }
Exemplo n.º 9
0
 public void haveClass(String className) {
   String actualClassName = selenWebElement.getAttribute("class");
   Assertion.test(expect, actualClassName, className, "Test for Class Name matching");
 }
Exemplo n.º 10
0
 public void selected() {
   boolean selected = selenWebElement.isSelected();
   Assertion.test(
       expect, selected, "Selected > Having Value : " + selenWebElement.getAttribute("value"));
 }