Upload files for native mobile application
To upload files to a native mobile application of TestCloud, you can use the pushFile
method.
The keyword is only available for Android devices.
Note:
The keyword is also accessible through the Katalon TestCloud Keywords plugin on Katalon Store. You can install the plugin to automatically load all TestCloud keywords into your Katalon project, without having to manually define them. To install the plugin, visit: Katalon TestCloud keywords.
On Android, you can push files to these folders:
/sdcard/Download/
/sdcard/Pictures
/sdcard/Android/data/<app_package>
driver.pushFile("/sdcard/Download/sample.jpg", new File("/Users/katalonuser/Desktop/sample.png"));
Sample code:
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver
String localPath = new File(RunConfiguration.getProjectDir() + '/' + 'Data Files/puppy.png').getCanonicalPath()
AppiumDriver<?> driver = MobileDriverFactory.getDriver()
driver.pushFile('/sdcard/Pictures/puppy.png', new File(localPath))