Skip to main content
This guide covers using BrowserStack to run mobile automation on real physical iOS devices in the cloud without needing local hardware.
Looking for other options? Check out the Local Quickstart for local devices, Cloud Mobile Quickstart for Minitap cloud devices, or Physical iOS Setup for USB-connected devices.

What is BrowserStack?

BrowserStack App Automate provides access to real physical iOS devices in the cloud. Key benefits:

Real Physical Devices

Test on actual iPhones and iPads, not simulators

No Local Hardware

No need to own or maintain iOS devices

CI/CD Ready

Perfect for automated testing pipelines

Cross-Device Testing

Access multiple device models and iOS versions

Prerequisites

1

BrowserStack Account

Sign up at BrowserStack and get access to App Automate.
2

Get Credentials

From your BrowserStack dashboard, get your:
  • Username: Your BrowserStack username
  • Access Key: Your BrowserStack access key
3

Upload Your App

Upload your iOS app (.ipa) to BrowserStack and get the app_url:
Response:
Save the app_url - you’ll need it to configure the BrowserStack client.
4

Install SDK


Creating Your First BrowserStack Automation

Basic Example

browserstack_demo.py

Run the Script


Configuration Options

BrowserStackClientConfig

Available Devices

BrowserStack supports a wide range of iOS devices. Some popular options:
Check BrowserStack’s device list for the complete list of available devices.

Environment Variables

For security, store your credentials as environment variables:
.env
Then load them in your script:
Never commit your .env file or hardcode credentials in your code. Add .env to your .gitignore.

Viewing Session Results

After running your automation, you can view detailed session information in the BrowserStack dashboard:
  1. Navigate to BrowserStack App Automate Dashboard
  2. Find your session by build name or session name
  3. View:
    • Video recording of the session
    • Screenshots at each step
    • Device logs
    • Network logs
The session URL is also logged when the session starts:

Supported Operations

The BrowserStack client supports the following operations:
Some operations like app_current() and install() are not supported on BrowserStack. Apps must be pre-uploaded to BrowserStack.

Complete Example with Structured Output

browserstack_structured.py

Troubleshooting

Possible causes:
  • Invalid credentials
  • Invalid app_url
  • Device/OS combination not available
Solutions:
  1. Verify your username and access key
  2. Re-upload your app and get a fresh app_url
  3. Check BrowserStack device list for valid device/OS combinations
Possible causes:
  • App not properly signed
  • App incompatible with selected iOS version
Solutions:
  1. Ensure your .ipa is signed for distribution
  2. Try a different iOS version that matches your app’s minimum deployment target
Possible causes:
  • Slow network connection
  • BrowserStack queue delays
Solutions:
  1. Check your internet connection
  2. Try during off-peak hours
  3. Consider using BrowserStack’s priority queue (paid feature)
Possible causes:
  • UI not fully loaded
  • Different UI on physical device vs simulator
Solutions:
  1. Add appropriate waits in your automation
  2. Use describe_all() to inspect the actual UI hierarchy
  3. Check the session video in BrowserStack dashboard

Best Practices

Use Environment Variables

Never hardcode credentials - use environment variables or secrets management

Organize Sessions

Use build_name and session_name to organize and find sessions easily

Handle Cleanup

Always use try/finally to ensure agent.clean() is called

Check Device Availability

Verify device/OS combinations before running tests

Next Steps

Local Quickstart

Set up local device automation

Cloud Mobiles

Use Minitap’s cloud devices

SDK Reference

Complete Agent API documentation

Examples

More automation examples