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

Enable and configure network logs for Appium tests

Enable network logs for your Appium tests on BrowserStack App Automate, capture response content, and limit capture to specific hosts.

Network logs are disabled by default. When you run a test without network logs 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.

Before you enable network logs, review the side effects of network log capture. If your app uses certificate pinning, see Fix certificate pinning failures.

Enable network logs

Select your integration method and set the capabilities:

If you use the BrowserStack SDK, set the following capability in the browserstack.yml file:

browserstack.yml
Copy icon Copy

After you enable network logs, the Network Logs tab on the dashboard shows the captured requests:

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

Capture response content

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 code snippet to set the network log configurations:

browserstack.yml
Copy icon Copy

Capture logs only for specific hosts

Use networkLogsIncludeHosts to capture network logs only for specific hosts. Traffic for all other hosts bypasses the BrowserStack MITM proxy and isn’t captured in network logs. Pass this capability at the top level, not inside networkLogsOptions.

Capability Description Value
networkLogsIncludeHosts Captures network logs only for the specified hosts. Traffic for all other hosts bypasses the BrowserStack MITM proxy and isn’t captured in network logs. List of hosts (Array) or regex value (String)

The following example captures logs only for requests made to google.com:

browserstack.yml
Copy icon Copy

Instead of a list, you can pass a regex value as a string. The following example captures logs for requests made to example.com and its subdomains:

browserstack.yml
Copy icon Copy

Both HTTP and HTTPS URLs are captured for the specified hosts.

The following rules apply to host filtering:

  • networkLogsIncludeHosts and networkLogsExcludeHosts are mutually exclusive. Passing both fails the session.
  • Each list accepts a maximum of 10 hosts, and each host entry, including a regex string, is capped at 200 characters.
  • Wildcards, such as *.example.com, aren’t supported. Use exact hostnames or a regex value.
  • Host filtering works at the host level only. You can’t include or exclude individual requests or paths on a host.

Next steps

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