Push files to device
For Android devices​
Preconditions
- This keyword is applicable for Android devices only. For iOS devices, refer to the workaround.
- You have installed the Katalon TestCloud Keywords plugin from Katalon Store. If you have not, visit:Â Katalon TestCloud Keywords.
- Follow this guide to install the plugins: Install plugins online from Katalon Store.
On Android, you can push files to these folders:
/sdcard/Download//sdcard/Pictures/sdcard/Android/data/<app_package>
Follow these steps:
-
In Katalon Studio, click the Profile drop-down and select Reload Plugins to make sure the plugin is installed.
-
Add theÂ
FileExecutor.pushFiletoDevice keyword to your test case.- In Manual view: Click (+) Add Custom Keyword and select
com.katalon.testcloud.FileExecutor.pushFiletoDevice. In the Input field, provide the values fordestinationPathandlocalFilePath.
- In Script view, the keyword is added as follows:
CustomKeywords.'com.katalon.testcloud.FileExecutor.pushFiletoDevice'("/sdcard/Pictures/puppy.png", "/Users/demouser/Pictures/puppy.png") - In Manual view: Click (+) Add Custom Keyword and select
Example code
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
'Push file to the device'
String localPath = '/Users/demouser/Pictures/puppy.png'
CustomKeywords.'com.katalon.testcloud.FileExecutor.pushFileToDevice'('/sdcard/Pictures/puppy.png', localPath)
'Login to the app'
Mobile.setText(findTestObject('Object Repository/Native App/MyDemoApp/android.widget.EditText - Username'), 'mydemouser', 0)
Mobile.setEncryptedText(findTestObject('Object Repository/Native App/MyDemoApp/android.widget.EditText - Password'), 'tTkSizDjdvtHYxURT8SvuQ==', 0)
Mobile.hideKeyboard(FailureHandling.OPTIONAL)
Mobile.tap(findTestObject('Object Repository/Native App/MyDemoApp/android.widget.Button - Login'), 0)
'Open the Gallery'
Mobile.tap(findTestObject('Object Repository/Native App/MyDemoApp/android.widget.Button - Camera'), 0)
Mobile.tap(findTestObject('Object Repository/Native App/MyDemoApp/android.widget.Button - Open Gallery'), 0)
'Take screenshot to verify the file is pushed to the device'
Mobile.takeScreenshot(FailureHandling.CONTINUE_ON_FAILURE)
- Configure your TestCloud mobile environment and run the test.
Workaround for iOS devices​
The pushFileToDevice keyword is not officially supported for iOS devices. To perform this action, apply the following workaround using Appium's pushFile function.
Preconditions
- The target app must enable file sharing by setting
UIFileSharingEnabled=truein Info.plist. - The test must obtain an active mobile driver instance (e.g., via
Mobile.startApplicationandMobileDriverFactory).
-
Specify the destination inside the app sandbox using this format
@<app_bundle_id>:Documents/<file_name>. -
Provide a
java.io.Filepointing to a resolved absolute/local path for the file to push. -
Use the
pushFilefunction in Appium with the destination path and the sourceFileobject.
note
- This workaround supports major iOS versions (for example, iOS 26 instead of 26.1).
- Ensure device/app permissions and sandboxing allow writing to the Documents directory.
Example:
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
Mobile.startApplication('24fa5a50-8d7d-42b3-9dec-aea3b1ab35bb', false)
String localPath = new File(RunConfiguration.getProjectDir() + '/' + 'Data Files/puppy.png').getCanonicalPath()
MobileDriverFactory.getDriver().pushFile("@com.test.ios.mydemoapp:Documents/puppy.png", new File(localPath));