/**
   * Sets the value of the "selectedIndex" property.
   *
   * @param index the new value
   */
  public void jsxSet_selectedIndex(final int index) {
    final HtmlSelect htmlSelect = getHtmlSelect();

    if (index != 0
        && getBrowserVersion()
            .hasFeature(BrowserVersionFeatures.JS_SELECT_SELECTED_INDEX_THROWS_IF_BAD)
        && (index < -1 || index >= htmlSelect.getOptionSize())) {
      throw Context.reportRuntimeError("Invalid index for select node: " + index);
    }

    for (final HtmlOption itemToUnSelect : htmlSelect.getSelectedOptions()) {
      htmlSelect.setSelectedAttribute(itemToUnSelect, false);
    }
    if (index < 0) {
      return;
    }

    final List<HtmlOption> allOptions = htmlSelect.getOptions();

    if (index < allOptions.size()) {
      final HtmlOption itemToSelect = allOptions.get(index);
      htmlSelect.setSelectedAttribute(itemToSelect, true, false);
    }
  }
  private ClaimBuildAction applyClaimWithFailureCauseSelected(
      String element, String error, String reason, String description) throws Exception {
    HtmlPage page = whenNavigatingtoClaimPage();
    page.getElementById(element).click();
    HtmlForm form = page.getFormByName("claim");
    form.getTextAreaByName("reason").setText(reason);
    HtmlSelect select = form.getSelectByName("_.errors");
    HtmlOption option = select.getOptionByValue(error);
    select.setSelectedAttribute(option, true);

    assertEquals(description, form.getTextAreaByName("errordesc").getTextContent());

    form.submit((HtmlButton) j.last(form.getHtmlElementsByTagName("button")));

    ClaimBuildAction action = build.getAction(ClaimBuildAction.class);
    return action;
  }
 /**
  * Selects the select's option value based on the year value given
  *
  * @param year the new year value to set
  * @return {@link AlbumPage}
  */
 public AlbumPage changeAlbumYear(int year) {
   HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
   HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
   albumYearSelectOption.setSelectedAttribute(yearOption, true);
   return this;
 }