Package daveayan.gherkinsalad.components.core

Examples of daveayan.gherkinsalad.components.core.Elements


  public void select_option_if_enabled(final String option) {
    select_code_if_enabled(option);
  }

  public void select_code_if_enabled(final String code) {
    Elements root_elements = root_elements();
    Element element_to_select = root_elements.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element input) {
        String value = input.getAttribute("value");
        if(value == null) return Boolean.FALSE;
        return value.trim().equals(code);
      }
View Full Code Here


    });
    element_to_select.click();
  }

  public Strings get_all_options() {
    Elements root_elements = root_elements();
    return toStrings(root_elements);
  }
View Full Code Here

  public String get_selected_option() {
    return get_selected_options().toString();
  }
 
  public Strings get_selected_options() {
    Elements root_elements = root_elements();
    Elements selected_elements = root_elements.findElementsThatMatch(new Predicate<Element>() {
      public boolean apply(Element input) {
        String checked = input.getAttribute("checked");
        if(checked == null) {
          return Boolean.FALSE;
        }
View Full Code Here

    super.name(name);
    return this;
  }

  public void select_option_if_enabled(final String option) {
    Elements root_elements = root_elements();
    final Elements all_labels = findElements(By.tagName("label"));
    Element element_to_select = root_elements.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element input) {
        final String id = input.getAttribute("id");
        Element label_for_radio_button = all_labels.findFirstElementThatMatches(new Predicate<Element>() {
          public boolean apply(Element input) {
            String label_for = input.getAttribute("for");
            return StringUtils.equals(label_for, id);
          }
        });
View Full Code Here

    });
    element_to_select.click();
  }

  public void select_code_if_enabled(final String code) {
    Elements root_elements = root_elements();
    Element element_to_select = root_elements.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element input) {
        String value = input.getAttribute("value");
        if(value == null) return Boolean.FALSE;
        return value.trim().equals(code);
      }
View Full Code Here

      error("Expected dropdown " + this + " to have none of these options " + Strings.instance_from(expected_options).toString() + " found these " + strings_present);
    }
  }

  public Strings get_all_options() {
    Elements root_elements = root_elements();
    return toStrings(root_elements);
  }
View Full Code Here

  public String get_selected_option_text() {
    final Element selected_element = getSelectedElement();
    if(selected_element.is_null()) {
      return StringUtils.EMPTY;
    }
    final Elements all_labels = findElements(By.tagName("label"));
    Element selected_element_label = all_labels.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element input) {
        String label_for = input.getAttribute("for");
        return StringUtils.equals(label_for, selected_element.getAttribute("id"));
      }
    });
View Full Code Here

        return input.getAttribute("value");
      }});
  }
 
  private Element getSelectedElement() {
    Elements root_elements = root_elements();
    Element selected_element = root_elements.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element input) {
        String checked = input.getAttribute("checked");
        if(checked == null) {
          return Boolean.FALSE;
        }
View Full Code Here

  }

  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

  }

  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

TOP

Related Classes of daveayan.gherkinsalad.components.core.Elements

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.