Skip to main content
🚀 Self Healing AI Agent now live in App Automate! Auto-fix flaky tests instantly with zero code changes. Enable now!
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

View network logs for Appium tests

Access network logs for your Appium test executions on BrowserStack App Automate. Capture data such as network traffic, latency, HTTP requests and more.

Network logs capture performance data such as network traffic, latency, HTTP requests, and responses in the HAR (HTTP Archive) format. Network logs list every network request your app makes, including REST API calls. Each entry shows the time the request took. Network logs help you identify performance bottlenecks or debug failed REST API responses. You can visualize HAR files using the 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.

Enable network logs

When you run a test without the network log settings enabled, the Network Logs tab on the dashboard shows the following message: The Network Logs tab on the dashboard showing that network logs are disabled for the session.

To enable network logs, use the following capability.

If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml file:

browserstack.yml
Copy icon Copy

The Network Logs tab on the dashboard showing that network logs are enabled for the session.

  • Free trial users do not have access to the network logs feature for app testing. To subscribe to a paid plan, visit the pricing page.

  • Network Logs feature is supported on all devices except the devices listed in the App Automate capabilities reference under the Capabilities Reference section.

  • Network Logs feature is not supported for proxy-unaware apps.

Network log configurations

By default, network logs record request and response metadata but not response bodies. To capture the response payload shown under the Response tab, set captureContent to true within networkLogsOptions. The following table describes the capability:

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

Use the following example code snippet to set the network log configurations:

browserstack.yml
Copy icon Copy

Download network logs

You can view network logs from the test session details page on the App Automate dashboard. To view or download the logs, select Raw Logs.

The App Automate dashboard with the Raw Logs option to view or download network logs.

Example network logs:

Sample Network Logs output

Import network logs using REST API

You can import the network logs from your test session 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"

Handling certificate pinning issues

App developers may use certificate pinning techniques to prevent man-in-the-middle attacks and thus enhance the app’s security. Using certificate pinning, the app developer can associate (or “pin”) a remote host or service with its certificate or public keys at the time of development. When the app makes a network request to a remote host, it compares the pinned certificate with the remote server’s certificate to verify its identity.

However, on BrowserStack, if you have enabled network logs, your tests could fail if your app uses certificate pinning. This is because BrowserStack uses a MITM proxy to capture the network logs, causing network requests between the app and pinned hosts to fail.

BrowserStack provides you additional capabilities to fix certificate pinning errors. Using these capabilities, you can bypass BrowserStack’s MITM proxy while making requests to certificate-pinned remote hosts.

networkLogsExcludeHosts

Pass this parameter at the top level, not inside networkLogsOptions. For example, this excludes capturing of logs for any requests made to google.com:

Capability Description Value
networkLogsExcludeHosts Use this capability to specify a list of certificate pinned hosts that should bypass BrowserStack MITM proxy while capturing network logs. By doing so, your tests can execute successfully while still capturing network logs for all other remaining hosts. List of certificate pinned hosts (Array) or regex value (String)
browserstack.yml
Copy icon Copy

Only HTTPS URLs will be ignored for the specified hosts

networkLogsIncludeHosts

Pass this parameter at the top level, not inside networkLogsOptions. For example, this captures logs only for requests made to google.com:

Capability Description Value
networkLogsIncludeHosts Use this capability if you wish to capture network logs only for specific hosts. Traffic for all other remaining hosts will bypass BrowserStack MITM proxy and won’t be captured in network logs. List of hosts (Array) or regex value (String)
browserstack.yml
Copy icon Copy

Both HTTP and HTTPS URLs will be captured for the specified hosts

Real-time network logs

If you route your app traffic through a local proxy, such as Charles Proxy, you can view network logs only in real time during the session by setting the browserstackLocal capability, or the browserstack.local capability for non-SDK setups, to true. For detailed setup steps, see Set up Charles Proxy with App Automate.

Enabling this option captures logs only in real time, and they are not available for viewing or download after the session ends.

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

Test web and mobile, from manual to automation, on real devices in one unified platform.

Contact Us

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