Upload custom contacts in App Automate
App Automate has a preloaded contact list on BrowserStack-hosted devices to test scenarios that require access to contacts from the device.
Apart from preloaded contact list, you can also upload your contact list in App Automate.
The contact list you upload on iOS or Android devices is stored in the default Contacts app of the devices.
In this guide, you’ll learn about:
- Supported devices and OS version
- How to set the browserstack.uploadMedia capability in your test script
Supported devices and OS version
OS | Device | OS version |
---|---|---|
Android | Phones and tablets | v7 and above |
iOS | iPhones and iPads | v11 and above |
Upload your custom contacts file to BrowserStack
- The contact file is in the vCard (
.vcf
) format. - The maximum file size to upload is 2 MB.
- The maximum number of custom contacts to upload on a device is 50.
- Files are stored on BrowserStack servers for at most 30 days.
Run the following upload media cURL command to upload your custom contacts (.vcf
) file to BrowserStack servers:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload-media" \
-F "file=@/path/to/contacts/file.vcf" \
-F "custom_id=SampleContacts"
A sample response for the given cURL command is as follows. It returns the value of the media_url
parameter.
{
"media_url": "media://90c7a8h8dc82308108734e9a46c24d8f01de12881",
"custom_id": "SampleContacts"
}
Set the capability in test script
Set the browserstack.uploadMedia
capability to the value of the media_url
parameter returned in the API response to upload your custom contacts onto the BrowserStack hosted device for testing, as shown in the following code snippets:
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.uploadMedia", new String[]{"media://90c7a8h8dc82308108734e9a46c24d8f01de12881"});
var capabilities = {
'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.uploadMedia", new[] {"media://90c7a8h8dc82308108734e9a46c24d8f01de12881"});
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.uploadMedia", ["media://90c7a8h8dc82308108734e9a46c24d8f01de12881"]);
desired_cap = {
'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
desired_caps = {
'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
Need some help?
If you need any help with this feature, get in touch with us.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!