Package daveayan.gherkinsalad.components.core

Examples of daveayan.gherkinsalad.components.core.Element


    }
    takeScreenshot();
  }
 
  public void remove_tab(String tab_to_remove) {
    Element tab = find_tab_li(tab_to_remove);
    Element tab_close_icon = tab.findElement(By.className("ui-icon-close"));
    if(tab_close_icon.is_null()) {
      error("Tab '" + tab_to_remove +"' does not have the icon to close it. Cannot remove");
    } else {
      tab_close_icon.click();
      action("Tab '" + tab_to_remove + "' removed.");
    }
    takeScreenshot();
  }
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 tab.getAttribute("aria-selected").contains("true");
  }
 
  private Element find_tab_li(final String tab_name) {
    Elements tabs = root_element().findElements(By.tagName("li"));
    Element tab = tabs.findFirstElementThatMatches(new Predicate<Element>() {
      public boolean apply(Element arg0) {
        return arg0.is(tab_name);
      }
    });
    return tab;
View Full Code Here

    }
  }
 
  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

    takeScreenshot();
  }
 
  private String get_month_in_picker() {
    while(true) {
      Element cal_month = root_element().findElement(By.className("ui-datepicker-month")).name("Date Picker - Month");
      String cal_month_text = cal_month.getText();
      if(StringUtils.isNotEmpty(cal_month_text)) {
        return cal_month_text;
      }
    }
  }
View Full Code Here

    }
  }
 
  private String get_year_in_picker() {
    while(true) {
      Element cal_year = root_element().findElement(By.className("ui-datepicker-year")).name("Date Picker - Year");
      String cal_year_text = cal_year.getText();
      if(StringUtils.isNotEmpty(cal_year_text)) {
        return cal_year_text;
      }
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public Strings get_all_options() {
    List<String> options = ListUtils.EMPTY_LIST;
    if(isEnabled()) {
      click_if_enabled();
      Element ul = find_ul_element();
      Elements li_a_s = ul.findElements(By.tagName("a"));
      options = li_a_s.asString();
      click_if_enabled();
    }
    return Strings.instance_from(options);
  }
View Full Code Here

 
  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

TOP

Related Classes of daveayan.gherkinsalad.components.core.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.