### Documentation - find_elements returns an empty array [] when no elements are found. - button(int), textfield(int) use xpath so 1 is the first button, 2 the second etc. 0 is invalid. #### [app_lib on rubydoc.info](http://www.rubydoc.info/github/appium/ruby_lib/master/toplevel) ##### General - [Appium](https://github.com/appium/appium/blob/master/README.md) - [Ruby selenium-webdriver](https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings) - [All methods supported by Appium](https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md) - [MiniTest Expectations](http://docs.seattlerb.org/minitest/Minitest/Expectations.html) ##### iOS - [iOS UI Automation](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html) Example use `@driver.execute_script "UIATarget.localTarget().frontMostApp().mainWindow().rect()" ` - [mechanic names of elements](https://github.com/jaykz52/mechanic/blob/8c490e1d225f384847e47ffdafb47cc2248bb96c/src/mechanic-core.js#L28) - [WebDriverAgent](https://github.com/facebook/WebDriverAgent) ##### Android - [Android UIAutomator](http://developer.android.com/tools/help/uiautomator/index.html) - [UiSelector.java](https://android.googlesource.com/platform/frameworks/testing/+/master/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java) -- Driver types. ```ruby # appium specific driver with helpers available @appium_driver = Appium::Driver.new @options # standard selenium driver without any appium methods @selenium_driver = @appium_driver.start_driver ``` -- Example of automating the built in Android settings. ```ruby # run Pry, and paste the following apk = { platformName: 'android', deviceName: :nexus, appPackage: 'com.android.settings', appActivity: '.Settings', appWaitActivity: '.Settings' } Appium::Driver.new(caps: apk).start_driver ``` -- Example use of Appium's mobile gesture. > @driver.find_element() `console.rb` uses some code from [simple_test.rb]( https://github.com/appium/appium/blob/82995f47408530c80c3376f4e07a1f649d96ba22/sample-code/examples/ruby/simple_test.rb) and is released under the [same license](https://github.com/appium/appium/blob/c58eeb66f2d6fa3b9a89d188a2e657cca7cb300f/LICENSE) as Appium. The [Accessibility Inspector](https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Testing_Accessibility/Testing_Accessibility.html) is helpful for discovering button names and textfield values. Long click on an ImageView in Android. ``` last_image = find_elements(:tag_name, :ImageView).last long_press(element: last_image) ``` Rotate examples. ```ruby driver.rotate :landscape driver.rotate :portrait ``` - `status["value"]["build"]["revision"]` Discover the Appium rev running on the server. - `driver.keyboard.send_keys "msg"` Sends keys to currently active element #### generic - `source` Prints a JSON view of the current page. - `page` Prints the content descriptions and text values on the current page. - `page_class` Prints the classes found on the current page. - `(Element) find(value)` Returns the first element that contains value. - `(Element) finds(value)` Returns all elements containing value (iOS only for now). - `(Element) name(name)` Returns the first element containing name. Android name is the content description. iOS uses accessibility label with a fallback to text. - `(Array) names(name)` Returns all elements containing name. - `(Element) text(text)` Returns the first element containing text. - `(Array) texts(text)` Returns all elements containing text. - `current_app` Returns information about the current app. Android only. -- #### alert 0. `(void) alert_accept` Accept the alert. 0. `(String) alert_accept_text` Get the text of the alert's accept button. 0. `(void) alert_click(value)` iOS only Tap the alert button identified by value. 0. `(void) alert_dismiss` Dismiss the alert. 0. `(String) alert_dismiss_text` Get the text of the alert's dismiss button. 0. `(String) alert_text` Get the alert message text. #### button 0. `(Button) button(index)` Find a button by index. 0. `(Button) button(text, number = 0)` Find a button by text and optionally number. 0. `(Button) button_include(text)` Get the first button that includes text. 0. `(Array, Array) buttons(text = nil)` Get an array of button texts or button elements if text is provided. 0. `(Array