lib/appium_lib/common/helper.rb in appium_lib-0.9.0 vs lib/appium_lib/common/helper.rb in appium_lib-0.9.1

- old
+ new

@@ -93,11 +93,12 @@ # Get the element of type tag_name at matching index. # @param tag_name [String] the tag name to find # @param index [Integer] the index # @return [Element] the found element of type tag_name def ele_index tag_name, index - # XPath index starts at 1. ruby_lib index starts at 0 - find_element :xpath, "//#{tag_name}[#{index + 1}]" + # XPath index starts at 1. + raise "#{index} is not a valid xpath index. Must be >= 1" if index <= 0 + find_element :xpath, "//#{tag_name}[#{index}]" end # Get all elements exactly matching tag name # @param tag_name [String] the tag name to find # @return [Array<Element>] the found elements of type tag_name \ No newline at end of file