Package daveayan.gherkinsalad.components.core

Examples of daveayan.gherkinsalad.components.core.Element


      action("Did not append text '" + text + "' in disabled text field '" + 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

    d.found(locator);
    return d;
  }
 
  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

  @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

    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

 
  public String get_selected_option_text() {
    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()) {
        info("Selected element is " + selected_element);
        option = selected_element.getText();
      }
      click_if_enabled();
    }
    return option;
  }
View Full Code Here

    }
    takeScreenshot();
  }

  public void selected_tab_should_be(String expected_selected_tab) {
    Element tab = find_tab_li(expected_selected_tab);
    if(tab_is_selected(tab)) {
      action("Verified that tab '" + expected_selected_tab +"' is selected");
    } else {
      error("Expected tab '" + expected_selected_tab + "' to be selected, it is not");
    }
View Full Code Here

    }
    takeScreenshot();
  }
 
  public void selected_tab_should_not_be(String expected_selected_tab) {
    Element tab = find_tab_li(expected_selected_tab);
    if(! tab_is_selected(tab)) {
      action("Verified that tab '" + expected_selected_tab +"' is not selected");
    } else {
      error("Expected tab '" + expected_selected_tab + "' to be not selected, it is");
    }
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.