Sha256: f21c6b1d9cdf449d15458be1af2f3c360c7317af9d9f5ef6e8f3de1295af133a

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

module WebConditions

  # @method elements_count_to_be_more_than(ele,count)
  # @param ele [Array of WebElement object]
  # @param ele [locator Hash] -- eg {:id => 'some_id'}]
  # @param count [Fixnum] -- expected count of elements present on page
  # @return [Boolean true] -- if actual count found on page is greater than expected count passed in param
  # @return [Boolean false] -- if actual count found on page is less than expected count passed in param

  def elements_count_to_be_more_than(loc,count)
    elements = @driver.find_elements(loc)
    if elements.size > count.to_i
      true
    else
      false
    end
  end


  # @method elements_count_to_be_less_than(ele,count)
  # @param ele [Array of WebElement object]
  # @param ele [locator Hash] -- eg {:id => 'some_id'}]
  # @param count [Fixnum] -- expected count of elements present on page
  # @return [Boolean true] -- if actual count found on page is less than expected count passed in param
  # @return [Boolean false] -- if actual count found on page is greater than expected count passed in param

  def elements_count_to_be_less_than(loc,count)
    elements = @driver.find_elements(loc)
    if elements.size < count.to_i
      true
    else
      false
    end
  end

  # @method elements_count_to_be_equal_to(ele,count)
  # @param ele [Array of WebElement object]
  # @param ele [locator Hash] -- eg {:id => 'some_id'}]
  # @param count [Fixnum] -- expected count of elements present on page
  # @return [Boolean true] -- if actual count found on page is less than expected count passed in param
  # @return [Boolean false] -- if actual count found on page is greater than expected count passed in param

  def elements_count_to_be_equal_to(loc,count)
    elements = @driver.find_elements(loc)
    if elements.size == count.to_i
      true
    else
      false
    end
  end

end #module WebConditions

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
web-object-0.5 lib/web-object/conditions/elements_count.rb
web-object-0.4 lib/web-object/conditions/elements_count.rb