id | title | hide_title | sidebar_label | description | keywords | url | site_name | slug | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
appium-upload-media |
Upload File and Media |
true |
Upload Files and Media |
Seamlessly upload media and files on Real Devices to enhance your testing scenarios and ensure comprehensive validation of your application's functionalities. |
|
LambdaTest |
upload-media/ |
import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Camera Image Injection", "item": "https://www.lambdatest.com/support/docs/uploadFileMedia/" }] }) }} ></script>LambdaTest's file upload feature provides a convenient way to enhance your testing scenarios by allowing you to upload various media and non-media files directly to LambdaTest's cloud devices. In this section, we'll guide you through the process of uploading files, highlight the supported file types, and explain how to use uploadMedia
capability while running your test scripts.
By the end of this topic, you will be able to:
- Use Upload File and Media feature in Manual App testing.
- Use Upload File and Media feature in App Automation.
Easily upload media or non-media files onto real devices during active sessions, enhancing your testing capabilities on LambdaTest's platform.
-
Go to App Testing under the Real Devices section provided in the sidebar of your LambdaTest console.
-
Once the session is started, locate the toolbar and find the Files and Media option.
<img loading="lazy" src={require('../assets/images/app-automation/uploadmedia.png').default} alt="Image" width="1200" height="550" className="doc_img"/>
-
You can now upload images, videos and files from your local on the device by clicking on the Upload button.
-
After the upload is completed, you can find the uploaded file or media in the specified
paths
mentioned below.
Category | Platform | Location | File Type |
---|---|---|---|
Media Files | Android | Default gallery app, /sdcard/Pictures |
Images |
Default gallery app, /sdcard/Movies |
Videos | ||
iOS | Camera Roll, /private/var/mobile/Media/DCIM/ |
Images and Videos | |
Non-Media Files | Android | Default Downloads folder of the device | Files |
iOS | App’s directory: Files app → On My iPhone → Your app's directory | Files |
LambdaTest supports various file types for upload, ensuring flexibility in your testing scenarios. Below are the supported file types:
- Images: JPG, JPEG, PNG, GIF (Maximum size: 10 MB)
- Videos: MP4 (Maximum size: 50 MB)
- Files: XLS, XLSX, DOC, DOCX, PDF, CSV, TXT (Maximum size: 15 MB)
This section provides a comprehensive guide on leveraging this feature within automation tests. It comprises two fundamental steps:
- Uploading the files and obtaining the
media_url
. - Using
media_url
into your tests usinguploadMedia
capability.
You can use the following curl command to upload any file media
and non-media
from your system to the LambdaTest cloud.
Request Parameters
media_file
: This parameter denotes the media file to be uploaded from your local.type
: This parameter denotes file type out of image,video and doc.custom_id
: This parameter specifies a custom identifier for the media file.
Below is a sample response demonstrating the return of the media_url
parameter value:
{
"media_url": "lt://MEDIAb48ab11c599944ee9dcd26b3e2978d3c",
"name": "sample.csv",
"status": "success",
"custom_id": "Sample"
}
You can also utilize LambdaTest's user-friendly UI to upload the files on Lambdatest cloud and get the media_url
using the upload button located at the top of the automation dashboard.
Once the files are uploaded to LambdaTest's cloud, seamlessly integrate files into your automation tests via the capability. Set the uploadMedia capability to the media_url parameter returned in the API response.
:::note
- Each automation session permits a maximum of five file uploads.
- In manual testing, iOS app needs to installed first to upload non-media files.
- For non-media files, make sure your iOS app's Info.plist file includes the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys set to true. This configuration is necessary to enable your app's folder accessibility within the Files app.
:::