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();
 }
 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();
 }
 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();
 }
 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");
 }
 private boolean tab_is_selected(Element tab) {
   return tab.getAttribute("aria-selected").contains("true");
 }