Package daveayan.gherkinsalad.components

Examples of daveayan.gherkinsalad.components.Element


 
  public String get_selected_option() {
    String option = StringUtils.EMPTY;
    if(isEnabled()) {
      click_if_enabled();
      Element ul = find_ul_element();
      Elements li_s = ul.findElements(By.tagName("a"));
     
      Element selected_element = li_s.findFirstElementThatMatches(new Predicate<Element>() {
        public boolean apply(Element li_a) {
          String value = li_a.getAttribute("aria-selected");
          if(StringUtils.isBlank(value)) {
            return false;
          }
          return Boolean.parseBoolean(value);
        }
      });
      if(selected_element.is_not_null()) {
        option = selected_element.getText();
      }
      click_if_enabled();
    }
    return option;
  }
View Full Code Here


  }

  public void select_option_if_enabled(String option) {
    if(isEnabled()) {
      click_if_enabled();
      Element ul = find_ul_element();
      Element element_to_select = ul.findElement(By.partialLinkText(option));
      element_to_select.click();
    }
  }
View Full Code Here

    return root_element().is_not_null();
  }
 
  public boolean isEnabled() {
    if(this.isDisplayed()) {
      Element a_link = root_element();
      return ! StringUtils.equalsIgnoreCase(a_link.getAttribute("aria-disabled"), "true");
    }
    return false;
  }
View Full Code Here

    }
    return false;
  }
 
  private Element find_ul_element() {
    Element a_link = root_element();
    String a_link_id = a_link.getAttribute("id");
    String ul_id = a_link_id.split("-button")[0] + "-menu";
    Element ul = findElement(By.id(ul_id));
    return ul;
  }
View Full Code Here

//    }
//    return false;
//  }

  public Element root_element() {
    Element element = findElement(element_locator);
    validate_position_and_css(element);
    return element;
  }
View Full Code Here

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

    super.name(name);
    return this;
  }
 
  public boolean isEnabled() {
    Element element = root_element();
    return element.isEnabled();
  }
View Full Code Here

    Element element = root_element();
    return element.isEnabled();
  }

  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

    t.found(root);
    return t;
  }
 
  public void select_tab(final String tab_name) {
    Element tab = find_tab_li(tab_name);
    if(tab_is_selected(tab)) {
      info("Tab '" + tab_name + "' is already selected.");
    } else {
      action("Selecting tab '" + tab_name + "', element '" + tab +"'");
      tab.findElement(By.tagName("a")).click();
    }
    takeScreenshot();
  }
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.