mirror of
https://github.com/appium/appium.git
synced 2026-02-11 04:20:00 -06:00
`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
1.8 KiB
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
Ruby + appium_lib gem
scroll_to 'Gallery'