Files
appium/docs/en/mobile_methods.md
2014-04-09 18:14:14 -04:00

1.9 KiB

title, layout
title layout
Cross platform mobile methods default

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
@driver.execute_script 'mobile: pullFile', {path: '/Library/AddressBook/AddressBook.sqlitedb'} #=> /Library/AddressBook/AddressBook.sqlitedb

#iOS only
@driver.execute_script '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'