<commit_before>module OperaWatir
  class SelectList < WebElement

    def select(value)
      find_option_by_text(items, value).setSelected
    end
    alias_method :set, :select

    def select_value(value)
      element.findElementsByTagName("option")
      find_option_by_val(items, value).setSelected
    end

    def selected?(value)
      element.findElementsByTagName("option")
      find_option_by_val(items, value).isSelected
    end

    def options
      @options ||= element.findElementsByTagName("option")
    end

    def option(method, value)
      options.find {|option| option.send(method) == value }
    end

  private

    def find_option_by_val(items, value)
      options.find {|item| item.getValue == value } ||
        raise(Exceptions::UnknownObjectException,
              "Unable to locate Option, using :value and #{value.inspect}")
    end

    def find_option_by_text(items, value)
      options.find {|item| item.getText == value} ||
        raise(Exceptions::UnknownObjectException,
              "Unable to locate Option, using :text and #{value.inspect}")
    end
  end

  class Option < WebElement
  end

end
<commit_msg>Fixed selectors for SelectList.<commit_after>module OperaWatir
  class SelectList < WebElement

    def select(text)
      find_option_by_text(options, text).setSelected
    end
    alias_method :set, :select

    def select_value(value)
      find_option_by_val(options, value).setSelected
    end

    def selected?(text)
      find_option_by_text(options, text).isSelected
    end

    def options
      @options ||= element.findElementsByTagName("option")
    end

    def option(method, value)
      options.find { |option| option.send(method) == value }
    end

  private

    def find_option_by_val(items, value)
      options.find { |item| item.getValue == value } ||
        raise(Exceptions::UnknownObjectException,
              "Unable to locate Option, using :value and #{value.inspect}")
    end

    def find_option_by_text(items, text)
      items.find { |item| item.getText == text } ||
        raise(Exceptions::UnknownObjectException,
              "Unable to locate Option, using :text and #{value.inspect}")
    end
  end

  class Option < WebElement
  end
end

{'fraction_non_alphanumeric': 0.09517426273458444, 'fraction_numerical': 0.0, 'mean_word_length': 3.0415162454873648, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1442991', 'n_tokens_mistral': 667, 'n_tokens_neox': 652, 'n_words': 159}