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; }
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); } }); element_to_select.click(); }
private Strings toStrings(Elements elements) { return elements.toStrings( new Function<Element, String>() { public String apply(Element input) { return input.getAttribute("value"); } }); }
public String get_selected_option() { 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; } return input.isSelected(); } }); if (selected_element.is_null()) { return StringUtils.EMPTY; } return selected_element.getAttribute("value"); }