Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Enable network logs for XCUI tests

Enable networks logs for your XCUI test executions on BrowserStack App Automate. Test your apps on a real device cloud.

Network Logs capture performance data such as network traffic, latency, HTTP requests and responses in the HAR (HTTP Archive) format. You can download network logs using both the App Automate dashboard, as well as using our REST API. You can visualize HAR files using a HAR Viewer.

Network logs are available on the BrowserStack dashboard for 30 days. These logs are deleted after 30 days from the day they are generated.

Network logs are disabled by default. To enable network logs, you need to pass the networkLogs parameter in the REST API request to start XCUITest test execution.

REST API endpoint:

POST /app-automate/xcuitest/build
Parameter Description Values
networkLogs Capture network logs for your test. true, false
Default: false

Example cURL request:

Enable network logs for an XCUI test execution:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/build" \
-d '{"networkLogs" : "true", "devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d", "testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-H "Content-Type: application/json"


View network logs on the dashboard:

On the test details page of App Automate dashboard, you can view network logs for each executed test case:

view network logs

Network log configurations

By default, network logs do not capture response payload. In order to capture response payload, you need to set captureContent configuration to true inside the browserstack.networkLogsOptions parameter in the REST API request.

Example cURL request:

Enable capture content for an XCUI test execution:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/xcuitest/build" \
-d '{"networkLogs" : "true","networkLogsOptions" : {"captureContent" : true}, "devices": ["iPhone 8 Plus-11.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d", "testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}' \
-H "Content-Type: application/json"

The following table provides information about the parameter:

Parameter Configuration Value
browserstack.networkLogsOptions captureContent true, false
Default: false (no content under Response tab)

Import network logs using REST API:

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" -X GET "https://api-cloud.browserstack.com/app-automate/builds/<build-id>/sessions/<session-id>/networklogs"
  1. You may experience minor impact on test execution speed when Network Logs are enabled.
  2. Certain apps such as Play Store, App Store, TestFlight etc. might not work on all OS versions when network logs are enabled.

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy Check Circle