Sha256: a645a5a7f8fb45c3e46dff63588e6f602fac44fff1359280ca7abdf142765236

Contents?: true

Size: 905 Bytes

Versions: 7

Compression:

Stored size: 905 Bytes

Contents

module TestCentricity
  class List < UIElement
    attr_accessor :list_item

    def initialize(parent, locator, context)
      @parent  = parent
      @locator = locator
      @context = context
      @type    = :list
      @alt_locator = nil
      list_spec = { :list_item => 'li' }
      define_list_elements(list_spec)
    end

    def define_list_elements(element_spec)
      element_spec.each do | element, value |
        case element
          when :list_item
            @list_item = value
        end
      end
    end

    def get_list_items(element_spec = nil)
      define_list_elements(element_spec) unless element_spec.nil?
      obj, _ = find_element
      object_not_found_exception(obj, nil)
      obj.all(@list_item).collect(&:text)
    end

    def get_item_count
      obj, _ = find_element
      object_not_found_exception(obj, nil)
      obj.all(@list_item).count
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
testcentricity_web-0.9.9.9 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.8 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.7 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.6 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.5 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.4 lib/testcentricity_web/elements/list.rb
testcentricity_web-0.9.9.3 lib/testcentricity_web/elements/list.rb