lib/testcentricity_web/web_elements/list.rb
def choose_item(item)
      obj, = find_element
      object_not_found_exception(obj, nil)
      if item.is_a?(Integer)
        obj.find(:css, "#{@list_item}:nth-of-type(#{item})", visible: true, minimum: 0, wait: 2).click
      elsif item.is_a?(String)
        items = obj.all(@list_item).collect(&:text)
        sleep(2) unless items.include?(item)
        obj.first(:css, @list_item, text: item).click
      end
    end
# Select the specified item in a list object. Accepts a String or Integer.
#
# @param item [String, Integer] text or index of item to select
#
# @example
#   province_list.choose_item(2)
#   province_list.choose_item('Manitoba')
#
Select the specified item in a list object. Accepts a String or Integer.
Select the specified item in a list object . Accepts a String or Integer .
def choose_item(item)
      obj, = find_element
      object_not_found_exception(obj, nil)
      if item.is_a?(Integer)
        obj.find(:css, "#{@list_item}:nth-of-type(#{item})", visible: true, minimum: 0, wait: 2).click
      elsif item.is_a?(String)
        items = obj.all(@list_item).collect(&:text)
        sleep(2) unless items.include?(item)
        obj.first(:css, @list_item, text: item).click
      end
    end
def choose_item ( item ) obj , = find_element object_not_found_exception ( obj , nil ) if item . is_a? ( Integer ) obj . find ( :css , "#{@list_item}:nth-of-type(#{item})" , visible : true , minimum : 0 , wait : 2 ) . click elsif item . is_a? ( String ) items = obj . all ( @list_item ) . collect ( & :text ) sleep ( 2 ) unless items . include? ( item ) obj . first ( :css , @list_item , text : item ) . click end end
Select the specified item in a list object.
Select the specified item in a list object .
item
text or index of item to select
text or index of item to select
example
None