lib/appium_lib/common/helper.rb in appium_lib-0.3.16 vs lib/appium_lib/common/helper.rb in appium_lib-0.4.0
- old
+ new
@@ -56,37 +56,39 @@
end
result
end
# Find by id. Useful for selendroid
+ # @param id [String] the id to search for
+ # @return [Element]
def id id
find_element :id, id
end
- # Presses the back button on Android.
+ # Navigate back.
# @return [void]
def back
@driver.navigate.back
end
- # For Sauce Labs reporting
+ # For Sauce Labs reporting. Returns the current session id.
def session_id
@driver.session_id
end
- def sauce_username
- @sauce_username
- end
-
- def sauce_access_key
- @sauce_access_key
- end
-
+ # Returns the first element that matches the provided xpath.
+ #
+ # @param xpath_str [String] the XPath string
+ # @return [Element]
def xpath xpath_str
find_element :xpath, xpath_str
end
+ # Returns all elements that match the provided xpath.
+ #
+ # @param xpath_str [String] the XPath string
+ # @return [Array<Element>]
def xpaths xpath_str
find_elements :xpath, xpath_str
end
# Get the element of type tag_name at matching index.
@@ -183,13 +185,21 @@
def get_source
# must set max nesting. default limit of 20 is too low for selendroid
JSON.parse @driver.page_source, max_nesting: 9999
end
+ # Returns the first element that matches name
+ #
+ # @param name [String] the name to match
+ # @return [Element]
def find_name name
find_element :name, name
end
+ # Returns all elements that match name
+ #
+ # @param name [String] the name to match
+ # @return [Array<Element>]
def find_names name
find_elements :name, name
end
-end # module Appium::Common
+end # module Appium::Common
\ No newline at end of file