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