Skip to main content

Uploading/Retrieving files on Real Devices


Whenever you are testing your application on LambdaTest Real Devices, you might have felt the need for some set of sample data that can help you achieve required output. Thus, to fulfill this need LambdaTest provides you with sample data like pre-loaded contacts, media files etc.

You can also upload files to the real device for testing and can also save the files produced for future reference. Let's see how.

Transferring the files


How to copy a file or folder to the real device?

We recognise that you need some files or folders on the device to test various things, such as uploading something to your app etc. Therefore, LambdaTest provides you with a set of pre-loaded media files on the real device so that you can test your apps. But, in case you need to upload something specific, you can upload and use it wherever required. For this functionality, we generally use Appium’s push file command to copy files into any folder.

How to retrieve a file or directory from the real device?

If your app has a feature of saving a file to the real device and you want to retrieve that file for later, you can do it by running the Appium's pull command

Refer to the code snippets given below for push and pull commands in different languages.

While using pull and push features of Appium, please copy the files and retrieve them from the given folders, /sdcard/Downloads/, /sdcard/Pictures and /sdcard/Android/data/<app_package>, on the LambdaTest Real Device.

 # Push a file
dest_path = '/sdcard/Downloads/file.txt'
driver.push_file(dest_path, 'Hello World'.encode("utf-8"))
# Pull a file
file_base64 = driver.pull_file(dest_path)

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles