docs/android_docs.md in appium_lib-0.6.3 vs docs/android_docs.md in appium_lib-0.6.4
- old
+ new
@@ -1,442 +1,649 @@
-##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L12)
+##### [s_texts](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L8)
-> def load_appium_txt opts
+> def s_texts
-Load appium.txt (toml format) into system ENV
-the basedir of this file + appium.txt is what's used
+Get an array of text texts.
-__Parameters:__
+__Returns:__
- [Hash] opts - file: '/path/to/appium.txt', verbose: true
+ [Array<String>]
+--
+
+##### [e_s_texts](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L14)
+
+> def e_s_texts
+
+Get an array of text elements.
+
__Returns:__
- [Array<String>] the require files. nil if require doesn't exist
+ [Array<Text>]
--
-##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L129)
+##### [first_s_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L20)
-> def self.promote_appium_methods class_array
+> def first_s_text
-Promote appium methods to class instance methods
+Get the first text element.
-To promote methods to all classes:
+__Returns:__
-```ruby
-Appium.promote_appium_methods Object
-```
+ [Text]
-__Parameters:__
+--
- [Array<Class>] class_array - An array of classes
+##### [last_s_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L26)
+> def last_s_text
+
+Get the last text element
+
+__Returns:__
+
+ [Text]
+
--
-##### [default_wait](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L426)
+##### [s_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L33)
-> def default_wait
+> def s_text text
-Returns the default client side wait.
-This value is independent of what the server is using
+Get the first element that includes text.
+__Parameters:__
+
+ [String, Integer] text - the text to find. If int then the text at that index is returned.
+
__Returns:__
- [Integer]
+ [Text]
--
-##### [app_path](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [s_text_exact](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/text.rb#L41)
-> def app_path
+> def s_text_exact text
-Returns the value of attribute app_path
+Get the first textfield that matches text.
---
+__Parameters:__
-##### [app_name](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+ [String] text - the text that the tag must match
-> def app_name
+__Returns:__
-Returns the value of attribute app_name
+ [Text]
--
-##### [device](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [window_size](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/window.rb#L5)
-> def device
+> def window_size
-Returns the value of attribute device
+Get the window's size
--
-##### [app_package](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [button](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L8)
-> def app_package
+> def button text, number=0
-Returns the value of attribute app_package
+Find a button by text and optionally number.
+__Parameters:__
+
+ [String, Integer] text - the text to exactly match. If int then the button at that index is returned.
+
+ [Integer] number - the occurrence of the button matching text. Defaults to the first button.
+
+__Returns:__
+
+ [Button] the button found with text and matching number
+
--
-##### [app_activity](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [buttons](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L19)
-> def app_activity
+> def buttons text=nil
-Returns the value of attribute app_activity
+Get an array of button texts or button elements if text is provided.
+__Parameters:__
+
+ [String] text - the text to exactly match
+
+__Returns:__
+
+ [Array<String>, Array<Buttons>] either an array of button texts or an array of button elements if text is provided.
+
--
-##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [first_button](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L26)
-> def app_wait_activity
+> def first_button
-Returns the value of attribute app_wait_activity
+Get the first button element.
+__Returns:__
+
+ [Button]
+
--
-##### [sauce_username](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [last_button](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L32)
-> def sauce_username
+> def last_button
-Returns the value of attribute sauce_username
+Get the last button element.
+__Returns:__
+
+ [Button]
+
--
-##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [button_exact](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L39)
-> def sauce_access_key
+> def button_exact text
-Returns the value of attribute sauce_access_key
+Get the first button element that exactly matches text.
+__Parameters:__
+
+ [String] text - the text to match exactly
+
+__Returns:__
+
+ [Button]
+
--
-##### [port](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [buttons_exact](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L46)
-> def port
+> def buttons_exact text
-Returns the value of attribute port
+Get all button elements that exactly match text.
+__Parameters:__
+
+ [String] text - the text to match exactly
+
+__Returns:__
+
+ [Array<Button>]
+
--
-##### [debug](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L158)
+##### [e_buttons](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L52)
-> def debug
+> def e_buttons
-Returns the value of attribute debug
+Get an array of button elements.
+__Returns:__
+
+ [Array<Button>]
+
--
-##### [initialize](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L190)
+##### [button_num](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/element/button.rb#L72)
-> def initialize opts={}
+> def button_num text, number=1
-Creates a new driver.
-:device is :android, :ios, or :selendroid
+Expected to be called via button method.
-```ruby
-# Options include:
-:app_path, :app_name, :app_package, :app_activity,
-:app_wait_activity, :sauce_username, :sauce_access_key,
-:port, :os, :debug
+Get the button element exactly matching text and
+occurrence. number=2 means the 2nd occurrence.
-require 'rubygems'
-require 'appium_lib'
+find the second Sign In button
-# Start iOS driver
-app = { device: :ios, app_path: '/path/to/MyiOS.app'}
-Appium::Driver.new(app).start_driver
+b = e_button 'Sign In', 2
-# Start Android driver
-apk = { device: :android
- app_path: '/path/to/the.apk',
- app_package: 'com.example.pkg',
- app_activity: 'act.Start',
- app_wait_activity: 'act.Start'
-}
+Button order will change in iOS vs Android
+so if there's no button found at number then
+return the first button.
-Appium::Driver.new(apk).start_driver
-```
+__Parameters:__
+ [String] text - the text to match
+
+ [Integer] number - the button occurance to return. 1 = first button
+
+__Returns:__
+
+ [Button] the button that matches text and number
+
+--
+
+##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L6) android
+
+> def tag_name_to_android tag_name
+
+Returns an array of android classes that match the tag name
+
__Parameters:__
- [Object] opts - A hash containing various options.
+ [String] tag_name - the tag name to convert to an android class
__Returns:__
- [Driver]
+ [String]
--
-##### [status](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L284)
+##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L194) android
-> def status
+> def find_eles_attr tag_name, attribute=nil
-Returns the status payload
+Find all elements matching the attribute
+On android, assume the attr is name (which falls back to text).
```ruby
-{"status"=>0,
- "value"=>
- {"build"=>
- {"version"=>"0.8.2",
- "revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
- "sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
+ find_eles_attr :text
```
- Discover the Appium rev running on the server.
+__Parameters:__
-`status["value"]["build"]["revision"]`
-`f2a2bc3782e4b0370d97a097d7e04913cf008995`
+ [String] tag_name - the tag name to search for
__Returns:__
- [JSON]
+ [Element]
--
-##### [server_version](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L290)
+##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L216) android
-> def server_version
+> def get_selendroid_inspect
-Returns the server's version string
+Selendroid only.
+Returns a string containing interesting elements.
__Returns:__
[String]
--
-##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L331)
+##### [get_page_class](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L278) android
-> def absolute_app_path
+> def get_page_class
-Converts environment variable APP_PATH to an absolute path.
+
+--
+
+##### [page_class](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L305) android
+
+> def page_class
+
+Count all classes on screen and print to stdout.
+Useful for appium_console.
+
+--
+
+##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L314) android
+
+> def get_android_inspect
+
+Android only.
+Returns a string containing interesting elements.
+If an element has no content desc or text, then it's not returned by this method.
+
__Returns:__
- [String] APP_PATH as an absolute path
+ [String]
--
-##### [server_url](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L347)
+##### [get_inspect](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L363) android
-> def server_url
+> def get_inspect
-Get the server url for sauce or local based on env vars.
+Automatically detects selendroid or android.
+Returns a string containing interesting elements.
__Returns:__
- [String] the server url
+ [String]
--
-##### [restart](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L357)
+##### [page](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L369) android
-> def restart
+> def page
-Restarts the driver
+Intended for use with console.
+Inspects and prints the current page.
+--
+
+##### [fast_duration](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L382) android
+
+> def fast_duration
+
+JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
+
+```javascript
+Math.round((duration * 1000) / 200)
+(.20 * 1000) / 200 = 1
+```
+
+We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
+
+--
+
+##### [xml_keys](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L389) android
+
+> def xml_keys target
+
+Search strings.xml's values for target.
+
+__Parameters:__
+
+ [String] target - the target to search for in strings.xml values
+
__Returns:__
- [Driver] the driver
+ [Array]
--
-##### [driver](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L364)
+##### [xml_values](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L396) android
-> def driver
+> def xml_values target
-Returns the driver
+Search strings.xml's keys for target.
+__Parameters:__
+
+ [String] target - the target to search for in strings.xml keys
+
__Returns:__
- [Driver] the driver
+ [Array]
--
-##### [screenshot](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L374)
+##### [resolve_id](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L403) android
-> def screenshot png_save_path
+> def resolve_id id
-Takes a png screenshot and saves to the target path.
+Resolve id in strings.xml and return the value.
-Example: screenshot '/tmp/hi.png'
+__Parameters:__
+ [String] id - the id to resolve
+
+__Returns:__
+
+ [String]
+
+--
+
+##### [current_app](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/helper.rb#L409) android
+
+> def current_app
+
+Lists package, activity, and adb shell am start -n value for current app.
+Works on local host only (not remote).
+
+--
+
+##### [alert_click](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/alert.rb#L6) android
+
+> def alert_click value
+
+Tap the alert button identified by value.
+
__Parameters:__
- [String] png_save_path - the full path to save the png
+ [Integer, String] value - either an integer index of the button or the button's name
__Returns:__
[void]
--
-##### [driver_quit](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L380)
+##### [alert_accept](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/alert.rb#L13) android
-> def driver_quit
+> def alert_accept
-Quits the driver
+Accept the alert.
+The last button is considered "accept."
__Returns:__
[void]
--
-##### [start_driver](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L388)
+##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/alert.rb#L20) android
-> def start_driver
+> def alert_accept_text
-Creates a new global driver and quits the old one if it exists.
+Get the text of the alert's accept button.
+The last button is considered "accept."
__Returns:__
- [Selenium::WebDriver] the new global driver
+ [String]
--
-##### [no_wait](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L412)
+##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/alert.rb#L27) android
-> def no_wait
+> def alert_dismiss
-Set implicit wait to zero.
+Dismiss the alert.
+The first button is considered "dismiss."
+__Returns:__
+
+ [void]
+
--
-##### [set_wait](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L419)
+##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/alert.rb#L34) android
-> def set_wait timeout=@default_wait
+> def alert_dismiss_text
-Set implicit wait to timeout, defaults to 30.
+Get the text of the alert's dismiss button.
+The first button is considered "dismiss."
+__Returns:__
+
+ [String]
+
+--
+
+##### [find](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L44) android
+
+> def find val
+
+Find the value contained in content description or text. Search elements
+in this order: EditText, Button, ImageButton
+
__Parameters:__
- [Integer] timeout - the timeout in seconds
+ [String] val - the value to search for
__Returns:__
- [void]
+ [Element]
--
-##### [exists](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L442)
+##### [text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L70) android
-> def exists pre_check=0, post_check=@default_wait, &search_block
+> def text text
-Returns existence of element.
+Return the first element matching text.
-Example:
+__Parameters:__
-exists { button('sign in') } ? puts('true') : puts('false')
+ [String] text - the text to search for
-__Parameters:__
+__Returns:__
- [Integer] pre_check - the amount in seconds to set the
-wait to before checking existance
+ [Element] the first matching element
- [Integer] post_check - the amount in seconds to set the
-wait to after checking existance
+--
- [Block] search_block - the block to call
+##### [texts](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L79) android
+> def texts text
+
+Return all elements matching text.
+
+__Parameters:__
+
+ [String] text - the text to search for
+
__Returns:__
- [Boolean]
+ [Array<Element>] all matching elements
--
-##### [execute_script](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L464)
+##### [name](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L88) android
-> def execute_script script, *args
+> def name name
-The same as @driver.execute_script
+Return the first element matching name.
+on Android name is content description
+on iOS name is the accessibility label or the text.
__Parameters:__
- [String] script - the script to execute
+ [String] name - the name to search for
- [*args] args - the args to pass to the script
-
__Returns:__
- [Object]
+ [Element] the first matching element
--
-##### [mobile](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L480)
+##### [names](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L99) android
-> def mobile method, *args
+> def names name
-Helper method for mobile gestures
+Return all elements matching name.
+on Android name is content description
+on iOS name is the accessibility label or the text.
-https://github.com/appium/appium/wiki/Automating-mobile-gestures
+__Parameters:__
-driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
+ [String] name - the name to search for
-becomes
+__Returns:__
-mobile :swipe, endX: 100, endY: 100, duration: 0.01
+ [Array<Element>] all matching elements
+--
+
+##### [scroll_to](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/generic.rb#L108) android
+
+> def scroll_to text
+
+Scroll to an element containing target text or description.
+
__Parameters:__
- [String, Symbol] method - the method to execute
+ [String] text - the text to search for in the text value and content description
- [*args] args - the args to pass to the method
+__Returns:__
+ [Element] the element scrolled to
+
+--
+
+##### [textfields](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L7) android
+
+> def textfields
+
+Get an array of textfield texts.
+
__Returns:__
- [Object]
+ [Array<String>]
--
-##### [find_elements](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L491)
+##### [e_textfields](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L13) android
-> def find_elements *args
+> def e_textfields
-Calls @driver.find_elements
+Get an array of textfield elements.
-__Parameters:__
+__Returns:__
- [*args] args - the args to use
+ [Array<Textfield>]
+--
+
+##### [first_textfield](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L19) android
+
+> def first_textfield
+
+Get the first textfield element.
+
__Returns:__
- [Array<Element>] Array is empty when no elements are found.
+ [Textfield]
--
-##### [find_element](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L499)
+##### [last_textfield](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L25) android
-> def find_element *args
+> def last_textfield
-Calls @driver.find_elements
+Get the last textfield element.
+__Returns:__
+
+ [Textfield]
+
+--
+
+##### [textfield](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L32) android
+
+> def textfield text
+
+Get the first textfield that includes text or name (content description).
+
__Parameters:__
- [*args] args - the args to use
+ [String, Integer] text - the text to search for. If int then the textfield at that index is returned.
__Returns:__
- [Element]
+ [Textfield]
--
-##### [x](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/driver.rb#L506)
+##### [textfield_exact](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/android/element/textfield.rb#L45) android
-> def x
+> def textfield_exact text
-Quit the driver and Pry.
-quit and exit are reserved by Pry.
+Get the first textfield that matches text.
+__Parameters:__
+
+ [String] text - the text to match
+
__Returns:__
- [void]
+ [Textfield]
--
-##### [wait](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L33)
+##### [wait](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L33)
> def wait max_wait=30, interval=0.5, &block
Check every 0.5 seconds to see if block.call doesn't raise an exception.
if .call raises an exception then it will be tried again.
@@ -459,19 +666,19 @@
[Object] the result of block.call
--
-##### [ignore](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L45)
+##### [ignore](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L45)
> def ignore &block
Return block.call and ignore any exceptions.
--
-##### [wait_true](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L55)
+##### [wait_true](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L55)
> def wait_true max_wait=30, interval=0.5, &block
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure.
Give up after 30 seconds.
@@ -488,11 +695,11 @@
[Object] the result of block.call
--
-##### [id](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L69)
+##### [id](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L69)
> def id id
Find by id. Useful for selendroid
@@ -504,11 +711,11 @@
[Element]
--
-##### [back](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L75)
+##### [back](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L75)
> def back
Navigate back.
@@ -516,19 +723,19 @@
[void]
--
-##### [session_id](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L80)
+##### [session_id](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L80)
> def session_id
For Sauce Labs reporting. Returns the current session id.
--
-##### [xpath](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L88)
+##### [xpath](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L88)
> def xpath xpath_str
Returns the first element that matches the provided xpath.
@@ -540,11 +747,11 @@
[Element]
--
-##### [xpaths](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L96)
+##### [xpaths](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L96)
> def xpaths xpath_str
Returns all elements that match the provided xpath.
@@ -556,11 +763,11 @@
[Array<Element>]
--
-##### [ele_index](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L104)
+##### [ele_index](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L104)
> def ele_index tag_name, index
Get the element of type tag_name at matching index.
@@ -574,11 +781,11 @@
[Element] the found element of type tag_name
--
-##### [find_eles](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L112)
+##### [find_eles](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L112)
> def find_eles tag_name
Get all elements exactly matching tag name
@@ -590,11 +797,11 @@
[Array<Element>] the found elements of type tag_name
--
-##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L120)
+##### [find_ele_by_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L120)
> def find_ele_by_text tag, text
Get the first tag that exactly matches tag and text.
@@ -608,11 +815,11 @@
[Element] the element of type tag exactly matching text
--
-##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L128)
+##### [find_eles_by_text](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L128)
> def find_eles_by_text tag, text
Get all tags that exactly match tag and text.
@@ -626,11 +833,11 @@
[Array<Element>] the elements of type tag exactly matching text
--
-##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L137)
+##### [find_ele_by_attr_include](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L137)
> def find_ele_by_attr_include tag, attr, value
Get the first tag by attribute that exactly matches value.
@@ -646,11 +853,11 @@
[Element] the element of type tag who's attribute includes value
--
-##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L146)
+##### [find_eles_by_attr_include](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L146)
> def find_eles_by_attr_include tag, attr, value
Get tags by attribute that include value.
@@ -666,11 +873,11 @@
[Array<Element>] the elements of type tag who's attribute includes value
--
-##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L155)
+##### [find_ele_by_text_include](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L155)
> def find_ele_by_text_include tag, text
Get the first tag that includes text.
element.attribute(:text).include? text
@@ -685,11 +892,11 @@
[Element] the element of type tag that includes text
--
-##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L164)
+##### [find_eles_by_text_include](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L164)
> def find_eles_by_text_include tag, text
Get the tags that include text.
element.attribute(:text).include? text
@@ -704,11 +911,11 @@
[Array<Element>] the elements of type tag that includes text
--
-##### [first_ele](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L171)
+##### [first_ele](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L171)
> def first_ele tag_name
Get the first tag that matches tag_name
@@ -720,11 +927,11 @@
[Element]
--
-##### [last_ele](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L179)
+##### [last_ele](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L179)
> def last_ele tag_name
Get the last tag that matches tag_name
@@ -736,11 +943,11 @@
[Element]
--
-##### [source](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L185)
+##### [source](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L185)
> def source
Prints a JSON view of the current page
@@ -748,11 +955,11 @@
[void]
--
-##### [get_source](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L191)
+##### [get_source](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L191)
> def get_source
Gets a JSON view of the current page
@@ -760,11 +967,11 @@
[JSON]
--
-##### [find_name](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L200)
+##### [find_name](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L200)
> def find_name name
Returns the first element that exactly matches name
@@ -776,11 +983,11 @@
[Element]
--
-##### [find_names](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L208)
+##### [find_names](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L208)
> def find_names name
Returns all elements that exactly match name
@@ -792,11 +999,11 @@
[Array<Element>]
--
-##### [tag](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L216)
+##### [tag](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L216)
> def tag tag_name
Returns the first element matching tag_name
@@ -808,11 +1015,11 @@
[Element]
--
-##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/helper.rb#L226)
+##### [px_to_window_rel](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/helper.rb#L226)
> def px_to_window_rel opts={}
Converts pixel values to window relative values
@@ -820,696 +1027,505 @@
px_to_window_rel x: 50, y: 150
```
--
-##### [s_texts](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L8)
+##### [value](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/patch.rb#L32)
-> def s_texts
+> def value
-Get an array of text texts.
+Returns the value attribute
-__Returns:__
+Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
- [Array<String>]
-
--
-##### [e_s_texts](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L14)
+##### [name](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/patch.rb#L39)
-> def e_s_texts
+> def name
-Get an array of text elements.
+Returns the name attribute
-__Returns:__
+Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
- [Array<Text>]
-
--
-##### [first_s_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L20)
+##### [tag_name](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/patch.rb#L46)
-> def first_s_text
+> def tag_name
-Get the first text element.
+Returns the type attribute
-__Returns:__
+Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
- [Text]
-
--
-##### [last_s_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L26)
+##### [location_rel](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/common/patch.rb#L58)
-> def last_s_text
+> def location_rel
-Get the last text element
+For use with mobile tap.
-__Returns:__
+```ruby
+execute_script 'mobile: tap', :x => 0.0, :y => 0.98
+```
- [Text]
+https://github.com/appium/appium/wiki/Automating-mobile-gestures
---
-
-##### [s_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L33)
-
-> def s_text text
-
-Get the first element that includes text.
-
-__Parameters:__
-
- [String, Integer] text - the text to find. If int then the text at that index is returned.
-
__Returns:__
- [Text]
+ [OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
--
-##### [s_text_exact](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/text.rb#L41)
+##### [CORE](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L16)
-> def s_text_exact text
+> CORE = [ :array, :hash, :class, :file, :dir, :bigdecimal, :rational, :struct, :openstruct, :method, :unboundmethod ]
-Get the first textfield that matches text.
-__Parameters:__
- [String] text - the text that the tag must match
-
-__Returns:__
-
- [Text]
-
--
-##### [window_size](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/window.rb#L5)
+##### [awesome_openstruct](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L18)
-> def window_size
+> def awesome_openstruct target
-Get the window's size
+
--
-##### [button](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L8)
+##### [load_appium_txt](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L28)
-> def button text, number=0
+> def load_appium_txt opts
-Find a button by text and optionally number.
+Load appium.txt (toml format) into system ENV
+the basedir of this file + appium.txt is what's used
__Parameters:__
- [String, Integer] text - the text to exactly match. If int then the button at that index is returned.
+ [Hash] opts - file: '/path/to/appium.txt', verbose: true
- [Integer] number - the occurrence of the button matching text. Defaults to the first button.
-
__Returns:__
- [Button] the button found with text and matching number
+ [Array<String>] the require files. nil if require doesn't exist
--
-##### [buttons](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L19)
+##### [promote_appium_methods](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L147)
-> def buttons text=nil
+> def self.promote_appium_methods class_array
-Get an array of button texts or button elements if text is provided.
+Promote appium methods to class instance methods
-__Parameters:__
+To promote methods to all classes:
- [String] text - the text to exactly match
+```ruby
+Appium.promote_appium_methods Object
+```
-__Returns:__
+__Parameters:__
- [Array<String>, Array<Buttons>] either an array of button texts or an array of button elements if text is provided.
+ [Array<Class>] class_array - An array of classes
--
-##### [first_button](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L26)
+##### [default_wait](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L444)
-> def first_button
+> def default_wait
-Get the first button element.
+Returns the default client side wait.
+This value is independent of what the server is using
__Returns:__
- [Button]
+ [Integer]
--
-##### [last_button](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L32)
+##### [app_path](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def last_button
+> def app_path
-Get the last button element.
+Returns the value of attribute app_path
-__Returns:__
-
- [Button]
-
--
-##### [button_exact](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L39)
+##### [app_name](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def button_exact text
+> def app_name
-Get the first button element that exactly matches text.
+Returns the value of attribute app_name
-__Parameters:__
+--
- [String] text - the text to match exactly
+##### [device](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-__Returns:__
+> def device
- [Button]
+Returns the value of attribute device
--
-##### [buttons_exact](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L46)
+##### [app_package](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def buttons_exact text
+> def app_package
-Get all button elements that exactly match text.
+Returns the value of attribute app_package
-__Parameters:__
+--
- [String] text - the text to match exactly
+##### [app_activity](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-__Returns:__
+> def app_activity
- [Array<Button>]
+Returns the value of attribute app_activity
--
-##### [e_buttons](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L52)
+##### [app_wait_activity](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def e_buttons
+> def app_wait_activity
-Get an array of button elements.
+Returns the value of attribute app_wait_activity
-__Returns:__
-
- [Array<Button>]
-
--
-##### [button_num](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/element/button.rb#L72)
+##### [sauce_username](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def button_num text, number=1
+> def sauce_username
-Expected to be called via button method.
+Returns the value of attribute sauce_username
-Get the button element exactly matching text and
-occurrence. number=2 means the 2nd occurrence.
+--
-find the second Sign In button
+##### [sauce_access_key](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-b = e_button 'Sign In', 2
+> def sauce_access_key
-Button order will change in iOS vs Android
-so if there's no button found at number then
-return the first button.
+Returns the value of attribute sauce_access_key
-__Parameters:__
+--
- [String] text - the text to match
+##### [port](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
- [Integer] number - the button occurance to return. 1 = first button
+> def port
-__Returns:__
+Returns the value of attribute port
- [Button] the button that matches text and number
-
--
-##### [tag_name_to_android](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L6) android
+##### [debug](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L176)
-> def tag_name_to_android tag_name
+> def debug
-Returns an array of android classes that match the tag name
+Returns the value of attribute debug
-__Parameters:__
+--
- [String] tag_name - the tag name to convert to an android class
+##### [initialize](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L208)
-__Returns:__
+> def initialize opts={}
- [String]
+Creates a new driver.
+:device is :android, :ios, or :selendroid
---
+```ruby
+# Options include:
+:app_path, :app_name, :app_package, :app_activity,
+:app_wait_activity, :sauce_username, :sauce_access_key,
+:port, :os, :debug
-##### [find_eles_attr](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L194) android
+require 'rubygems'
+require 'appium_lib'
-> def find_eles_attr tag_name, attribute=nil
+# Start iOS driver
+app = { device: :ios, app_path: '/path/to/MyiOS.app'}
+Appium::Driver.new(app).start_driver
-Find all elements matching the attribute
-On android, assume the attr is name (which falls back to text).
+# Start Android driver
+apk = { device: :android
+ app_path: '/path/to/the.apk',
+ app_package: 'com.example.pkg',
+ app_activity: 'act.Start',
+ app_wait_activity: 'act.Start'
+}
-```ruby
- find_eles_attr :text
+Appium::Driver.new(apk).start_driver
```
__Parameters:__
- [String] tag_name - the tag name to search for
+ [Object] opts - A hash containing various options.
__Returns:__
- [Element]
+ [Driver]
--
-##### [get_selendroid_inspect](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L216) android
+##### [status](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L302)
-> def get_selendroid_inspect
+> def status
-Selendroid only.
-Returns a string containing interesting elements.
+Returns the status payload
-__Returns:__
+```ruby
+{"status"=>0,
+ "value"=>
+ {"build"=>
+ {"version"=>"0.8.2",
+ "revision"=>"f2a2bc3782e4b0370d97a097d7e04913cf008995"}},
+ "sessionId"=>"8f4b34a7-a9a9-4ac5-b125-36258143446a"}
+```
- [String]
+ Discover the Appium rev running on the server.
---
+`status["value"]["build"]["revision"]`
+`f2a2bc3782e4b0370d97a097d7e04913cf008995`
-##### [get_page_class](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L278) android
+__Returns:__
-> def get_page_class
+ [JSON]
-
-
--
-##### [page_class](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L305) android
+##### [server_version](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L308)
-> def page_class
+> def server_version
-Count all classes on screen and print to stdout.
-Useful for appium_console.
+Returns the server's version string
---
-
-##### [get_android_inspect](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L314) android
-
-> def get_android_inspect
-
-Android only.
-Returns a string containing interesting elements.
-If an element has no content desc or text, then it's not returned by this method.
-
__Returns:__
[String]
--
-##### [get_inspect](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L363) android
+##### [absolute_app_path](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L349)
-> def get_inspect
+> def absolute_app_path
-Automatically detects selendroid or android.
-Returns a string containing interesting elements.
+Converts environment variable APP_PATH to an absolute path.
__Returns:__
- [String]
+ [String] APP_PATH as an absolute path
--
-##### [page](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L369) android
+##### [server_url](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L365)
-> def page
+> def server_url
-Intended for use with console.
-Inspects and prints the current page.
+Get the server url for sauce or local based on env vars.
---
-
-##### [fast_duration](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L382) android
-
-> def fast_duration
-
-JavaScript code from https://github.com/appium/appium/blob/master/app/android.js
-
-```javascript
-Math.round((duration * 1000) / 200)
-(.20 * 1000) / 200 = 1
-```
-
-We want steps to be exactly 1. If it's zero then a tap is used instead of a swipe.
-
---
-
-##### [xml_keys](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L389) android
-
-> def xml_keys target
-
-Search strings.xml's values for target.
-
-__Parameters:__
-
- [String] target - the target to search for in strings.xml values
-
__Returns:__
- [Array]
+ [String] the server url
--
-##### [xml_values](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L396) android
+##### [restart](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L375)
-> def xml_values target
+> def restart
-Search strings.xml's keys for target.
+Restarts the driver
-__Parameters:__
-
- [String] target - the target to search for in strings.xml keys
-
__Returns:__
- [Array]
+ [Driver] the driver
--
-##### [resolve_id](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L403) android
+##### [driver](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L382)
-> def resolve_id id
+> def driver
-Resolve id in strings.xml and return the value.
+Returns the driver
-__Parameters:__
-
- [String] id - the id to resolve
-
__Returns:__
- [String]
+ [Driver] the driver
--
-##### [current_app](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/helper.rb#L409) android
+##### [screenshot](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L392)
-> def current_app
+> def screenshot png_save_path
-Lists package, activity, and adb shell am start -n value for current app.
-Works on local host only (not remote).
+Takes a png screenshot and saves to the target path.
---
+Example: screenshot '/tmp/hi.png'
-##### [alert_click](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/alert.rb#L6) android
-
-> def alert_click value
-
-Tap the alert button identified by value.
-
__Parameters:__
- [Integer, String] value - either an integer index of the button or the button's name
+ [String] png_save_path - the full path to save the png
__Returns:__
[void]
--
-##### [alert_accept](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/alert.rb#L13) android
+##### [driver_quit](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L398)
-> def alert_accept
+> def driver_quit
-Accept the alert.
-The last button is considered "accept."
+Quits the driver
__Returns:__
[void]
--
-##### [alert_accept_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/alert.rb#L20) android
+##### [start_driver](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L406)
-> def alert_accept_text
+> def start_driver
-Get the text of the alert's accept button.
-The last button is considered "accept."
+Creates a new global driver and quits the old one if it exists.
__Returns:__
- [String]
+ [Selenium::WebDriver] the new global driver
--
-##### [alert_dismiss](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/alert.rb#L27) android
+##### [no_wait](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L430)
-> def alert_dismiss
+> def no_wait
-Dismiss the alert.
-The first button is considered "dismiss."
+Set implicit wait to zero.
-__Returns:__
-
- [void]
-
--
-##### [alert_dismiss_text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/alert.rb#L34) android
+##### [set_wait](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L437)
-> def alert_dismiss_text
+> def set_wait timeout=@default_wait
-Get the text of the alert's dismiss button.
-The first button is considered "dismiss."
+Set implicit wait to timeout, defaults to 30.
-__Returns:__
-
- [String]
-
---
-
-##### [find](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L44) android
-
-> def find val
-
-Find the value contained in content description or text. Search elements
-in this order: EditText, Button, ImageButton
-
__Parameters:__
- [String] val - the value to search for
+ [Integer] timeout - the timeout in seconds
__Returns:__
- [Element]
+ [void]
--
-##### [text](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L70) android
+##### [exists](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L460)
-> def text text
+> def exists pre_check=0, post_check=@default_wait, &search_block
-Return the first element matching text.
+Returns existence of element.
-__Parameters:__
+Example:
- [String] text - the text to search for
+exists { button('sign in') } ? puts('true') : puts('false')
-__Returns:__
-
- [Element] the first matching element
-
---
-
-##### [texts](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L79) android
-
-> def texts text
-
-Return all elements matching text.
-
__Parameters:__
- [String] text - the text to search for
+ [Integer] pre_check - the amount in seconds to set the
+wait to before checking existance
-__Returns:__
+ [Integer] post_check - the amount in seconds to set the
+wait to after checking existance
- [Array<Element>] all matching elements
+ [Block] search_block - the block to call
---
-
-##### [name](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L88) android
-
-> def name name
-
-Return the first element matching name.
-on Android name is content description
-on iOS name is the accessibility label or the text.
-
-__Parameters:__
-
- [String] name - the name to search for
-
__Returns:__
- [Element] the first matching element
+ [Boolean]
--
-##### [names](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L99) android
+##### [execute_script](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L482)
-> def names name
+> def execute_script script, *args
-Return all elements matching name.
-on Android name is content description
-on iOS name is the accessibility label or the text.
+The same as @driver.execute_script
__Parameters:__
- [String] name - the name to search for
+ [String] script - the script to execute
-__Returns:__
+ [*args] args - the args to pass to the script
- [Array<Element>] all matching elements
-
---
-
-##### [scroll_to](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/generic.rb#L108) android
-
-> def scroll_to text
-
-Scroll to an element containing target text or description.
-
-__Parameters:__
-
- [String] text - the text to search for in the text value and content description
-
__Returns:__
- [Element] the element scrolled to
+ [Object]
--
-##### [textfields](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L7) android
+##### [mobile](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L498)
-> def textfields
+> def mobile method, *args
-Get an array of textfield texts.
+Helper method for mobile gestures
-__Returns:__
+https://github.com/appium/appium/wiki/Automating-mobile-gestures
- [Array<String>]
+driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01
---
+becomes
-##### [e_textfields](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L13) android
+mobile :swipe, endX: 100, endY: 100, duration: 0.01
-> def e_textfields
+__Parameters:__
-Get an array of textfield elements.
+ [String, Symbol] method - the method to execute
-__Returns:__
+ [*args] args - the args to pass to the method
- [Array<Textfield>]
-
---
-
-##### [first_textfield](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L19) android
-
-> def first_textfield
-
-Get the first textfield element.
-
__Returns:__
- [Textfield]
+ [Object]
--
-##### [last_textfield](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L25) android
+##### [find_elements](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L509)
-> def last_textfield
+> def find_elements *args
-Get the last textfield element.
+Calls @driver.find_elements
-__Returns:__
-
- [Textfield]
-
---
-
-##### [textfield](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L32) android
-
-> def textfield text
-
-Get the first textfield that includes text or name (content description).
-
__Parameters:__
- [String, Integer] text - the text to search for. If int then the textfield at that index is returned.
+ [*args] args - the args to use
__Returns:__
- [Textfield]
+ [Array<Element>] Array is empty when no elements are found.
--
-##### [textfield_exact](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/android/element/textfield.rb#L45) android
+##### [find_element](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L517)
-> def textfield_exact text
+> def find_element *args
-Get the first textfield that matches text.
+Calls @driver.find_elements
__Parameters:__
- [String] text - the text to match
+ [*args] args - the args to use
__Returns:__
- [Textfield]
+ [Element]
--
-##### [value](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/patch.rb#L32)
+##### [x](https://github.com/appium/ruby_lib/blob/ccf8e375283bd9038fcf6c1db576f7539065e6d0/lib/appium_lib/driver.rb#L524)
-> def value
+> def x
-Returns the value attribute
+Quit the driver and Pry.
+quit and exit are reserved by Pry.
-Fixes NoMethodError: undefined method `value' for Selenium::WebDriver::Element
-
---
-
-##### [name](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/patch.rb#L39)
-
-> def name
-
-Returns the name attribute
-
-Fixes NoMethodError: undefined method `name' for Selenium::WebDriver::Element
-
---
-
-##### [tag_name](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/patch.rb#L46)
-
-> def tag_name
-
-Returns the type attribute
-
-Fixes Selenium::WebDriver::Error::UnknownError: Not yet implemented
-
---
-
-##### [location_rel](https://github.com/appium/ruby_lib/blob/509e7b81f02c6b0c4cdcb07aca034c9dad260ff4/lib/appium_lib/common/patch.rb#L58)
-
-> def location_rel
-
-For use with mobile tap.
-
-```ruby
-execute_script 'mobile: tap', :x => 0.0, :y => 0.98
-```
-
-https://github.com/appium/appium/wiki/Automating-mobile-gestures
-
__Returns:__
- [OpenStruct] the relative x, y in a struct. ex: { x: 0.50, y: 0.20 }
+ [void]
--