Sha256: e74283c3596786e29e1871036aa2599ea7c8b89c63a67b5cddb00197a8fd2670

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

module OperaWatir
  class QuickDropdownItem < QuickEditField #QuickWidget # QuickEditField?

    # @private
    # Checks the type of the widget is correct
    def correct_type?
      @element.getType == WIDGET_ENUM_MAP[:dropdownitem]
    end

    ######################################################################
    # Checks if the item is selected
    #
    # @return [Boolean] true if the dropdown has the item with the
    #                   string_id selected, otherwise false
    #
    # @raise [Exceptions::UnknownObjectException] if the widget could not be found
    #           using the specified method
    def selected?
      element(true).isSelected()
    end

    ##########################################################################
    # Select item by click
    #
    # @example
    #    browser.quick_dropdownitem(:text, "Activate the next tab").select_with_click
    #
    # @return true if item is now selected, otherwise false
    #
    def select_with_click
      if mac_internal?
        press_menu
      else
        click
      end
      selected?
    end

    private

    # Selects an item from a drop down pop menu where you can't click them on Mac
    def press_menu
      driver.pressQuickMenuItem(text, true);
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.7.pre3-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.7.pre2-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.7.pre1-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.6.pre1-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.5.1-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.5-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.5.pre3-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.5.pre2-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb
operawatir-0.5.pre1-jruby lib/operawatir/quickwidgets/quick_dropdownitem.rb