Permalink
14d1835 Aug 27, 2018
4 contributors

Users who have contributed to this file

@bootstraponline @KazuCocoa @xrd @waynema
2381 lines (1200 sloc) 60.1 KB
load_settings

def load_settings(opts = {})

Load arbitrary text (toml format) The toml is parsed by https://github.com/fbernier/tomlrb .

[caps]
app = "path/to/app"

[appium_lib]
port = 8080

:app is expanded :require is expanded all keys are converted to symbols

Parameters:

     [Hash] opts - file: '/path/to/appium.txt', verbose: true

Returns:

     [hash] the symbolized hash with updated :app and :require keys

--

load_appium_txt

def load_settings(opts = {})

Load arbitrary text (toml format) The toml is parsed by https://github.com/fbernier/tomlrb .

[caps]
app = "path/to/app"

[appium_lib]
port = 8080

:app is expanded :require is expanded all keys are converted to symbols

Parameters:

     [Hash] opts - file: '/path/to/appium.txt', verbose: true

Returns:

     [hash] the symbolized hash with updated :app and :require keys

--

expand_required_files

def expand_required_files(base_dir, file_paths)

Parameters:

     [String] base_dir - parent directory of loaded appium.txt (toml)

     [String] file_paths -

Returns:

     [Array] list of require files as an array, nil if require doesn't exist

--

promote_singleton_appium_methods

def promote_singleton_appium_methods(modules, driver = $driver)

This method is intended to work with page objects that share a common module. For example, Page::HomePage, Page::SignIn those could be promoted on with Appium.promote_singleton_appium_methods Page

If you are promoting on an individual class then you should use Appium.promote_appium_methods instead. The singleton method is intended only for the shared module use case.

if modules is a module instead of an array, then the constants of that module are promoted on. otherwise, the array of modules will be used as the promotion target.

Parameters:

     [Array] modules - An array of modules

     [Driver] driver - A driver to extend for

--

promote_appium_methods

def promote_appium_methods(class_array, driver = $driver)

Promote appium methods to class instance methods

To promote methods to all classes:

It's better to promote on specific classes instead of Object

Parameters:

     [Array] class_array - An array of classes

     [Driver] driver - A driver to extend for

--

global_webdriver_http_sleep

def global_webdriver_http_sleep

The amount to sleep in seconds before every webdriver http call.

--

global_webdriver_http_sleep=

def global_webdriver_http_sleep=(value)

The amount to sleep in seconds before every webdriver http call.

--

sauce

def sauce

SauceLab's settings

--

sauce_username

def sauce_username

Username for use on Sauce Labs. Set false to disable Sauce, even when SAUCE_USERNAME is in ENV. same as @sauce.username

--

sauce_access_key

def sauce_access_key

Access Key for use on Sauce Labs. Set false to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV. same as @sauce.access_key

--

sauce_endpoint

def sauce_endpoint

Override the Sauce Appium endpoint to allow e.g. TestObject tests same as @sauce.endpoint

--

caps

def caps

from Core read http://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver

--

custom_url

def custom_url

Returns the value of attribute custom_url

--

export_session

def export_session

Returns the value of attribute export_session

--

export_session_path

def export_session_path

Returns the value of attribute export_session_path

--

default_wait

def default_wait

Returns the value of attribute default_wait

--

appium_port

def appium_port

Returns the value of attribute appium_port

--

appium_device

def appium_device

Returns the value of attribute appium_device

--

automation_name

def automation_name

Returns the value of attribute automation_name

--

listener

def listener

Returns the value of attribute listener

--

http_client

def http_client

Returns the value of attribute http_client

--

appium_wait_timeout

def appium_wait_timeout

Returns the value of attribute appium_wait_timeout

--

appium_wait_interval

def appium_wait_interval

Returns the value of attribute appium_wait_interval

--

appium_server_status

def appium_server_status

Appium's server version

--

appium_debug

def appium_debug

Boolean debug mode for the Appium Ruby bindings

--

driver

def driver

Returns the driver

Returns:

     [Driver] the driver

--

core

def core

Instance of Appium::Core::Driver

--

initialize

def initialize(opts = {}, global_driver = nil)

Creates a new driver. The driver is defined as global scope by default. We can avoid defining global driver.

Parameters:

     [Object] opts - A hash containing various options.

     [Bool] global_driver - A bool require global driver before initialize.

Returns:

     [Driver]

--

driver_attributes

def driver_attributes

Returns a hash of the driver attributes

--

device_is_android?

def device_is_android?

Returns:

     [Boolean]

--

device_is_ios?

def device_is_ios?

Returns:

     [Boolean]

--

device_is_windows?

def device_is_windows?

Returns:

     [Boolean]

--

automation_name_is_uiautomator2?

def automation_name_is_uiautomator2?

Return true if automationName is 'uiautomator2'

Returns:

     [Boolean]

--

automation_name_is_espresso?

def automation_name_is_espresso?

Return true if automationName is 'Espresso'

Returns:

     [Boolean]

--

automation_name_is_xcuitest?

def automation_name_is_xcuitest?

Return true if automationName is 'XCUITest'

Returns:

     [Boolean]

--

dialect

def dialect

Get the dialect value whether current driver is OSS or W3C

Returns:

     [:oss | :w3c] @example

if dialect == :w3c
  driver.action
        .move_to_location(500, 500).pointer_down(:left)
        .move_to_location(0, 700)
        .release.perform
else
  action = TouchAction.new(driver).press(x: 500, y: 500).move_to(500, 700).release
  action.perform
end

--

check_server_version_xcuitest

def check_server_version_xcuitest

Return true if the target Appium server is over REQUIRED_VERSION_XCUITEST. If the Appium server is under REQUIRED_VERSION_XCUITEST, then error is raised.

Returns:

     [Boolean]

--

appium_server_version

def appium_server_version

Returns the server's version info

Returns:

     [Hash]

--

remote_status

def appium_server_version

Returns the server's version info

Returns:

     [Hash]

--

platform_version

def platform_version

Return the platform version as an array of integers

Returns:

     [Array]

--

appium_client_version

def appium_client_version

Returns the client's version info

Returns:

     [Hash]

--

absolute_app_path

def self.absolute_app_path(opts)

Converts app_path to an absolute path.

opts is the full options hash (caps and appium_lib). If server_url is set then the app path is used as is.

if app isn't set then an error is raised.

Returns:

     [String] APP_PATH as an absolute path

--

server_url

def server_url

Get the server url

Returns:

     [String] the server url

--

restart

def restart

Restarts the driver

Returns:

     [Driver] the driver

--

screenshot

def screenshot(png_save_path)

Takes a png screenshot and saves to the target path.

Parameters:

     [String] png_save_path - the full path to save the png

Returns:

     [File]

--

element_screenshot

def element_screenshot(element, png_save_path)

Takes a png screenshot of particular element's area

Parameters:

     [String] element - Element take a screenshot

     [String] png_save_path - the full path to save the png

Returns:

     [File]

--

driver_quit

def driver_quit

Quits the driver

Returns:

     [void]

--

quit_driver

def driver_quit

Quits the driver

Returns:

     [void]

--

window_size

def window_size

Get the device window's size.

Returns:

     [Selenium::WebDriver::Dimension]

--

start_driver

def start_driver(http_client_ops =

Creates a new global driver and quits the old one if it exists. You can customise http_client as the following

Read http://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Device to understand more what the driver can call instance methods.

Parameters:

     [Hash] http_client_ops - a customizable set of options

Returns:

     [Selenium::WebDriver] the new global driver

--

set_implicit_wait

def set_implicit_wait(wait)

To ignore error for Espresso Driver

--

no_wait

def no_wait

Set implicit wait to zero.

--

set_wait

def set_wait(timeout = nil)

Set implicit wait. Default to @core.default_wait.

Parameters:

     [Integer] timeout - the timeout in seconds

Returns:

     [void]

--

exists

def exists(pre_check = 0, post_check = @core.default_wait)

Returns existence of element.

Example:

exists { button('sign in') } ? puts('true') : puts('false')

Parameters:

     [Integer] pre_check - The amount in seconds to set the wait to before checking existence

     [Integer] post_check - The amount in seconds to set the wait to after checking existence

Returns:

     [Boolean]

--

execute_script

def execute_script(script, *args)

The same as @driver.execute_script

Parameters:

     [String] script - The script to execute

     [*args] args - The args to pass to the script

Returns:

     [Object]

--

find_elements

def find_elements(*args)

Calls @driver.find_elements_with_appium

If you call Appium.promote_appium_methods, you can call find_elements directly.

If you call Appium.promote_appium_methods, you can call find_elements directly.

Parameters:

     [*args] args - The args to use

Returns:

     [Array] Array is empty when no elements are found.

--

find_element

def find_element(*args)

Calls @driver.find_element

If you call Appium.promote_appium_methods, you can call find_element directly.

Parameters:

     [*args] args - The args to use

Returns:

     [Element]

--

DEFAULT_MATCH_THRESHOLD

DEFAULT_MATCH_THRESHOLD = 0.5

Return ImageElement if current view has a partial image

Parameters:

     [String] png_img_path - A path to a partial image you'd like to find

     [Flood] match_threshold - At what normalized threshold to reject

     [Bool] visualize - Makes the endpoint to return an image, which contains the visualized result of the corresponding picture matching operation. This option is disabled by default.

Returns:

     [::Appium::Core::ImageElement]

--

find_element_by_image

def find_element_by_image(png_img_path, match_threshold: DEFAULT_MATCH_THRESHOLD, visualize: false)

--

find_elements_by_image

def find_elements_by_image(png_img_paths, match_threshold: DEFAULT_MATCH_THRESHOLD, visualize: false)

Return ImageElement if current view has partial images

Parameters:

     [[String]] png_img_paths - Paths to a partial image you'd like to find

     [Flood] match_threshold - At what normalized threshold to reject

     [Bool] visualize - Makes the endpoint to return an image, which contains the visualized result of the corresponding picture matching operation. This option is disabled by default.

Returns:

     [[::Appium::Core::ImageElement]]

--

set_location

def set_location(opts = {})

Calls @driver.set_location

Parameters:

     [Hash] opts - consisting of:

Returns:

     [Selenium::WebDriver::Location] the location constructed by the selenium webdriver

--

x

def x

Quit the driver and Pry. quit and exit are reserved by Pry.

Returns:

     [void]

--

username

def username

Username for use on Sauce Labs. Set false to disable Sauce, even when SAUCE_USERNAME is in ENV.

--

access_key

def access_key

Access Key for use on Sauce Labs. Set false to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV.

--

endpoint

def endpoint

Override the Sauce Appium endpoint to allow e.g. TestObject tests. Default is 'ondemand.saucelabs.com:443/wd/hub'.

--

initialize

def initialize(appium_lib_opts)

Create a SauceLabs instance to manage sauce labs related attributes.

Parameters:

     [Hash] appium_lib_opts - Appium library parameter

Returns:

     [Appium::SauceLabs]

--

sauce_server_url?

def sauce_server_url?

Return true if an instance of Appium::SauceLabs has sauce_username and sauce_access_key.

Returns:

     [Boolean]

--

server_url

def server_url

Return a particular server url to access to. Default is the local address.

Returns:

     [String]

--

get_log

def get_log(type)

Parameters:

     [String|Hash] type - You can get particular type's logs.

Returns:

     [[Selenium::WebDriver::LogEntry]] A list of logs data.

--

get_available_log_types

def get_available_log_types

Get a list of available log types

Returns:

     [[String]] A list of available log types.

--

wait_true

def wait_true(opts = {})

Check every interval seconds to see if yield returns a truthy value. Note this isn't a strict boolean true, any truthy value is accepted. false and nil are considered failures. Give up after timeout seconds.

Wait code from the selenium Ruby gem https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb

If only a number is provided then it's treated as the timeout value.

Parameters:

     [Hash|Numeric] opts - Options. If the value is Numeric, the value is set as { timeout: value }

--

wait

def wait(opts = {})

Check every interval seconds to see if yield doesn't raise an exception. Give up after timeout seconds.

Wait code from the selenium Ruby gem https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb

If only a number is provided then it's treated as the timeout value.

Parameters:

     [Hash|Numeric] opts - Options. If the value is Numeric, the value is set as { timeout: value }

--

add_touch_actions

def add_touch_actions

--

delegate_from_appium_driver

def delegate_from_appium_driver(method, delegation_target)

--

ignore

def ignore

Return yield and ignore any exceptions.

--

back

def back

Navigate back.

Returns:

     [void]

--

session_id

def session_id

For Sauce Labs reporting. Returns the current session id.

Returns:

     [String]

--

xpath

def xpath(xpath_str)

Returns the first element that matches the provided xpath.

Parameters:

     [String] xpath_str - the XPath string

Returns:

     [Element]

--

xpaths

def xpaths(xpath_str)

Returns all elements that match the provided xpath.

Parameters:

     [String] xpath_str - the XPath string

Returns:

     [Array]

--

result

def result

Returns the value of attribute result

--

initialize

def initialize(platform)

Returns:

     [CountElements] a new instance of CountElements

--

reset

def reset

--

start_element

def start_element(name, attrs = [])

http://nokogiri.org/Nokogiri/XML/SAX/Document.html

--

formatted_result

def formatted_result

--

get_page_class

def get_page_class

Returns a string of class counts of visible elements.

Returns:

     [String]

--

page_class

def page_class

Count all classes on screen and print to stdout. Useful for appium_console.

Returns:

     [nil]

--

source

def source

Prints xml of the current page

Returns:

     [void]

--

get_source

def get_source

Returns XML string for the current page Same as driver.page_source

Returns:

     [String]

--

px_to_window_rel

def px_to_window_rel(opts = {}, driver = $driver)

Converts pixel values to window relative values

--

xml_keys

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]

--

xml_values

def xml_values(target)

Search strings.xml's keys for target.

Parameters:

     [String] target - the target to search for in strings.xml keys

Returns:

     [Array]

--

resolve_id

def resolve_id(id)

Resolve id in strings.xml and return the value.

Parameters:

     [String] id - the id to resolve

Returns:

     [String]

--

filter

def filter

Returns the value of attribute filter

--

filter=

def filter=(value)

convert to string to support symbols

--

initialize

def initialize

Returns:

     [HTMLElements] a new instance of HTMLElements

--

reset

def reset

--

result

def result

--

start_element

def start_element(name, attrs = [])

--

end_element

def end_element(name)

--

characters

def characters(chars)

--

DEFAULT_HEADERS

DEFAULT_HEADERS = { 'Accept' => CONTENT_TYPE, 'User-Agent' => "appium/ruby_lib/#{::Appium::VERSION}" }.freeze

Default HTTP client inherit Appium::Core::Base::Http::Default, but has different DEFAULT_HEADERS

--

pinch

def pinch(percentage = 25, auto_perform = true, driver = $driver)

Convenience method for pinching the screen. Places two fingers at the edges of the screen and brings them together. Without auto_perform

With driver

Parameters:

     [int] percentage - The percent size by which to shrink the screen when pinched.

     [boolean] auto_perform - Whether to perform the action immediately (default true)

     [Driver] driver - Set a driver to conduct the action. DEfault is global driver($driver)

--

zoom

def zoom(percentage = 200, auto_perform = true, driver = $driver)

Convenience method for zooming the screen. Places two fingers at the edges of the screen and brings them together. Without auto_perform

With driver

Parameters:

     [int] percentage - The percent size by which to shrink the screen when pinched.

     [boolean] auto_perform - Whether to perform the action immediately (default true)

     [Driver] driver - Set a driver to conduct the action. DEfault is global driver($driver)

--

initialize

def initialize(driver = $driver)

self

Returns:

     [MultiTouch] a new instance of MultiTouch

--

COMPLEX_ACTIONS

COMPLEX_ACTIONS = ::Appium::Core::TouchAction::COMPLEX_ACTIONS

--

initialize

def initialize(driver = $driver)

Returns:

     [TouchAction] a new instance of TouchAction

--

swipe

def swipe(opts)

--

initialize

def initialize(url:, output_file: 'logcat.log')

Returns:

     [WsLogcat] a new instance of WsLogcat

--

handle_message_data

def handle_message_data(data)

--

for android

def self.for(target)

--

TextView android

TextView = 'android.widget.TextView'.freeze

--

text android

def text(value)

Find the first TextView that contains value or by index. If int then the TextView at that index is returned.

Parameters:

     [String, Integer] value - the value to find.

Returns:

     [TextView]

--

texts android

def texts(value = false)

Find all TextViews containing value. If value is omitted, all texts are returned.

Parameters:

     [String] value - the value to search for

Returns:

     [Array]

--

first_text android

def first_text

Find the first TextView.

Returns:

     [TextView]

--

last_text android

def last_text

Find the last TextView.

Returns:

     [TextView]

--

text_exact android

def text_exact(value)

Find the first TextView that exactly matches value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [TextView]

--

texts_exact android

def texts_exact(value)

Find all TextViews that exactly match value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Array]

--

result android

def result

Returns the value of attribute result

--

keys android

def keys

Returns the value of attribute keys

--

filter android

def filter

Returns the value of attribute filter

--

filter= android

def filter=(value)

convert to string to support symbols

--

initialize android

def initialize

Returns:

     [AndroidElements] a new instance of AndroidElements

--

reset android

def reset

--

start_element android

def start_element(name, attrs = [], driver = $driver)

http://nokogiri.org/Nokogiri/XML/SAX/Document.html

--

get_android_inspect android

def get_android_inspect(class_name = false)

Android only. Returns a string containing interesting elements. The text, content description, and id are returned. if false (default) then all classes will be inspected

Parameters:

     [String] class_name - the class name to filter on.

Returns:

     [String]

--

page android

def page(opts = {})

Intended for use with console. Inspects and prints the current page. Will return XHTML for Web contexts because of a quirk with Nokogiri. if nil (default) then all classes will be inspected

Parameters:

     [Hash] class - a customizable set of options

Returns:

     [void]

--

id android

def id(id)

Find the first matching element by id

Parameters:

     [String] id - the id to search for

Returns:

     [Element]

--

ids android

def ids(id)

Find all matching elements by id

Parameters:

     [String] id - the id to search for

Returns:

     [Element]

--

ele_index android

def ele_index(class_name, index)

Find the element of type class_name at matching index.

Parameters:

     [String] class_name - the class name to find

     [Integer] index - the index

Returns:

     [Element] the found element of type class_name

--

first_ele android

def first_ele(class_name)

Find the first element that matches class_name

Parameters:

     [String] class_name - the tag to match

Returns:

     [Element]

--

last_ele android

def last_ele(class_name)

Find the last element that matches class_name

Parameters:

     [String] class_name - the tag to match

Returns:

     [Element]

--

tag android

def tag(class_name)

Find the first element of type class_name

Parameters:

     [String] class_name - the class_name to search for

Returns:

     [Element]

--

tags android

def tags(class_name)

Find all elements of type class_name

Parameters:

     [String] class_name - the class_name to search for

Returns:

     [Element]

--

string_visible_contains_xpath android

def string_visible_contains_xpath(class_name, value)

Returns a string that matches the first element that contains value For automationName is uiautomator2 example: string_visible_contains_xpath 'UIATextField', 'sign in' note for XPath: https://github.com/appium/ruby_lib/pull/561

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [String]

--

string_visible_contains android

def string_visible_contains(class_name, value)

Returns a string that matches the first element that contains value For automationName is Appium example: string_visible_contains 'UIATextField', 'sign in' note for XPath: https://github.com/appium/ruby_lib/pull/561

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [String]

--

complex_find_contains android

def complex_find_contains(class_name, value)

Find the first element that contains value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

complex_finds_contains android

def complex_finds_contains(class_name, value)

Find all elements containing value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Array]

--

complex_find_exact android

def complex_find_exact(class_name, value)

Find the first element exactly matching value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

complex_finds_exact android

def complex_finds_exact(class_name, value)

Find all elements exactly matching value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

alert_click android

def alert_click(value)

Click the first alert button that contains value or by index.

Parameters:

     [Integer, String] value - either an integer index of the button or the button's name

Returns:

     [void]

--

alert_accept android

def alert_accept

Accept the alert. The last button is considered "accept."

Returns:

     [void]

--

alert_accept_text android

def alert_accept_text

Get the text of the alert's accept button. The last button is considered "accept."

Returns:

     [String]

--

alert_dismiss android

def alert_dismiss

Dismiss the alert. The first button is considered "dismiss."

Returns:

     [void]

--

alert_dismiss_text android

def alert_dismiss_text

Get the text of the alert's dismiss button. The first button is considered "dismiss."

Returns:

     [String]

--

Button android

Button = 'android.widget.Button'.freeze

--

ImageButton android

ImageButton = 'android.widget.ImageButton'.freeze

--

button android

def button(value)

Find the first button that contains value or by index. If int then the button at that index is returned.

Parameters:

     [String, Integer] value - the value to exactly match.

Returns:

     [Button]

--

buttons android

def buttons(value = false)

Find all buttons containing value. If value is omitted, all buttons are returned.

Parameters:

     [String] value - the value to search for

Returns:

     [Array]

--

first_button android

def first_button

Find the first button.

Returns:

     [Button]

--

last_button android

def last_button

Find the last button.

Returns:

     [Button]

--

button_exact android

def button_exact(value)

Find the first button that exactly matches value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Button]

--

buttons_exact android

def buttons_exact(value)

Find all buttons that exactly match value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Array

]

--

find android

def find(value)

Find the first element containing value

Parameters:

     [String] value - the value to search for

Returns:

     [Element]

--

finds android

def finds(value)

Find all elements containing value

Parameters:

     [String] value - the value to search for

Returns:

     [Array]

--

find_exact android

def find_exact(value)

Find the first element exactly matching value

Parameters:

     [String] value - the value to search for

Returns:

     [Element]

--

finds_exact android

def finds_exact(value)

Find all elements exactly matching value

Parameters:

     [String] value - the value to search for

Returns:

     [Array]

--

scroll_to android

def scroll_to(text, scrollable_index = 0)

Scroll to the first element containing target text or description.

Parameters:

     [String] text - the text or resourceId to search for in the text value and content description

     [Integer] scrollable_index - the index for scrollable views.

Returns:

     [Element] the element scrolled to

--

scroll_to_exact android

def scroll_to_exact(text, scrollable_index = 0)

Scroll to the first element with the exact target text or description.

Parameters:

     [String] text - the text or resourceId to search for in the text value and content description

     [Integer] scrollable_index - the index for scrollable views.

Returns:

     [Element] the element scrolled to

--

for android

def self.for(target)

--

EditText android

EditText = 'android.widget.EditText'.freeze

--

textfield android

def textfield(value)

Find the first EditText that contains value or by index. If int then the EditText at that index is returned.

Parameters:

     [String, Integer] value - the text to match exactly.

Returns:

     [EditText]

--

textfields android

def textfields(value = false)

Find all EditTexts containing value. If value is omitted, all EditTexts are returned.

Parameters:

     [String] value - the value to search for

Returns:

     [Array]

--

first_textfield android

def first_textfield

Find the first EditText.

Returns:

     [EditText]

--

last_textfield android

def last_textfield

Find the last EditText.

Returns:

     [EditText]

--

textfield_exact android

def textfield_exact(value)

Find the first EditText that exactly matches value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [EditText]

--

textfields_exact android

def textfields_exact(value)

Find all EditTexts that exactly match value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Array]

--

for android

def self.for(target)

--

string_visible_contains android

def string_visible_contains(class_name, value)

Returns a string that matches the first element that contains value For automationName is Appium example: string_visible_contains 'UIATextField', 'sign in' note for XPath: https://github.com/appium/ruby_lib/pull/561

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [String]

--

complex_find_contains android

def complex_find_contains(class_name, value)

Find the first element that contains value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

complex_finds_contains android

def complex_finds_contains(class_name, value)

Find all elements containing value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Array]

--

complex_find_exact android

def complex_find_exact(class_name, value)

Find the first element exactly matching value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

complex_finds_exact android

def complex_finds_exact(class_name, value)

Find all elements exactly matching value

Parameters:

     [String] class_name - the class name for the element

     [String] value - the value to search for

Returns:

     [Element]

--

shell android

def shell(command, arguments)

Conduct an adb shell script on Appium server. Require --relaxed-security arguments when run Appium server as server side arguments.

Parameters:

     [String] command - Command for "adb shell"

     [Array] arguments - Arguments for the adb command

--

start_logs_broadcast android

def start_logs_broadcast(logcat_file = 'logcat.log')

Starts Android logcat broadcast websocket

Parameters:

     [String] logcat_file - A file path to write messages from a logcat WebSocket client

--

stop_logs_broadcast android

def stop_logs_broadcast

Stop Android logcat broadcast websocket

--

button android

def button(value)

Find the first button that contains value or by index. If int then the button at that index is returned.

Parameters:

     [String, Integer] value - the value to exactly match.

Returns:

     [Button]

--

buttons android

def buttons(value = false)

Find all buttons containing value. If value is omitted, all buttons are returned.

Parameters:

     [String] value - the value to search for

Returns:

     [Array

]

--

first_button android

def first_button

Find the first button.

Returns:

     [Button]

--

last_button android

def last_button

Find the last button.

Returns:

     [Button]

--

button_exact android

def button_exact(value)

Find the first button that exactly matches value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Button]

--

buttons_exact android

def buttons_exact(value)

Find all buttons that exactly match value.

Parameters:

     [String] value - the value to match exactly

Returns:

     [Array

]

--