Files
appium/docs/mobile_methods.md
Dylan Lacey f2f349a36d Added pullFile support for iOS simulator.
`mobile: pullFile {:path => '/Some/Path'}` fetches a file relative to
the root of the device's filesystem.

`mobile: pullFile {:path => '/Applications/Some.app'}` fetches a file
relative to the root of that Application's .app directory, adding in the
GUID.

Fixes #2010, #1807
2014-04-02 22:19:25 -07:00

1.8 KiB

Cross platform mobile methods

Reset

Mobile reset will reset the app's state.

Ruby + appium_lib gem

mobile :reset

Ruby without the gem

@driver.execute_script 'mobile: reset'
pullFile

Fetch a file from the device's filesystem, returning it base64 encoded.

Takes a single argument, path. On Android and iOS, this is either the path to the file (relative to the root of the app's file system). On iOS only, if path starts with /AppName.app, which will be replaced with the application's .app directory

# Android and iOS
'mobile: pullFile', {path: '/Library/AddressBook/AddressBook.sqlitedb'} #=> /Library/AddressBook/AddressBook.sqlitedb

#iOS only
'mobile: pullFile, {path: '/UICatalog.app/logfile.log'} #=> /Applications/12323-452262-24241-23-124124/UICatalog.app/logfile.log

Ruby

@driver.execute_script('mobile: pullFile', {path: '/Library/AddressBook/AddressBook.sqlitedb'})

Android mobile methods

KeyEvent

KeyEvent enables sending a keycode to Android.

Press the system menu button in Java.

HashMap<String, Integer> keycode = new HashMap<String, Integer>();
keycode.put("keycode", 82);
((JavascriptExecutor)driver).executeScript("mobile: keyevent", keycode);

Ruby + appium_lib gem

mobile :keyevent, keycode: 82

Ruby without the gem

@driver.execute_script 'mobile: keyevent', :keycode => 82

Mobile find

Java

See MobileFindJavaTest.java

Ruby + appium_lib gem

scroll_to 'Gallery'