Package daveayan.gherkinsalad.components

Examples of daveayan.gherkinsalad.components.Element


  /**
   * Default implementation. Returns the value from getText() method of WebElement
   */
  public String getText() {
    Element element = root_element();
    return element.getText();
  }
View Full Code Here


  /**
   * Default Implementation.
   */
  public boolean isEnabled() {
    Element element = root_element();
    String disabled_attribute = element.getAttribute("disabled");
    return element.isEnabled() && (disabled_attribute == null);
  }
View Full Code Here

  /**
   * Default Implementation.
   */
  public boolean isDisplayed() {
    Element element = root_element();
    if(element.is_not_null() && element.isDisplayed()) {
      return true;
    }
    return false;
  }
View Full Code Here

    super.name(name);
    return this;
  }

  public void click_if_enabled() {
    Element element = root_element();
    if(this.isEnabled()) {
      element.click();
    }
  }
View Full Code Here

    super.name(name);
    return this;
  }

  public void select_option_if_enabled(String option) {
    Element element = root_element();
    if (this.isEnabled()) {
      Elements options = element.findElements(By.tagName("option"));
      Element option_to_select = options.findFirstElementWithText(option);
      option_to_select.click();
    }
  }
View Full Code Here

      option_to_select.click();
    }
  }

  public void select_code_if_enabled(String code) {
    Element element = root_element();
    if (this.isEnabled()) {
      Elements options = element.findElements(By.tagName("option"));
      for (Element o : options._nativeList()) {
        if (StringUtils.equals(o.getAttribute("value"), code)) {
          o.click();
          break;
        }
View Full Code Here

  }

  public String get_selected_option() {
    if (isEnabled()) {
      Elements options = root_element().findElements(By.tagName("option"));
      Element selected_option = options.findFirstElementThatMatches(new Predicate<Element>() {
        public boolean apply(Element input) {
          String selected = input.getAttribute("selected");
          if(StringUtils.isNotBlank(selected)) {
            return selected.equals("selected");
          }
          return false;
        }
      });
      return selected_option.getText();
    }
    return StringUtils.EMPTY;
  }
View Full Code Here

    super.name(name);
    return this;
  }

  public void click_if_enabled() {
    Element element = root_element();
    if(this.isEnabled()) {
      element.click();
    } else {
      action("Did not click '" + this + "' since it is not enabled");
    }
  }
View Full Code Here

      action("Did not click '" + this + "' since it is not enabled");
    }
  }
 
  public void click_if_exists() {
    Element element = root_element();
    if(this.isDisplayed()) {
      element.click();
    } else {
      action("Did not click '" + this + "' since it is not displayed");
    }
  }
View Full Code Here

      action("Did not click '" + this + "' since it is not displayed");
    }
  }
 
  public void click_if_exists_and_enabled() {
    Element element = root_element();
    if(this.isEnabled() && this.isDisplayed()) {
      element.click();
    } else {
      action("Did not click '" + this + "' since it is not enabled and not displayed");
    }
  }
View Full Code Here

TOP

Related Classes of daveayan.gherkinsalad.components.Element

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.