### 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) #### Drivers - [platform-support](https://github.com/appium/appium/blob/master/docs/en/about-appium/platform-support.md) -- Driver types. ```ruby # appium specific driver with helpers available @appium_driver = Appium::Driver.new @options, false # 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}, false).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/sample-code/blob/master/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 is helpful for discovering button names and textfield values. Long click on an ImageView in Android. ``` last_image = find_elements(:class, 'ImageView').last long_press(element: last_image) ``` Rotate examples. The behaviour is depends on devices. ```ruby driver.rotate :landscape driver.rotate :portrait ``` - `appium_server_version` Discover the Appium rev running on the server. - `element.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)` 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