Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Work with PAC files for Detox tests

Use a Proxy Auto-Configuration (PAC) file to route Local Testing traffic for your Detox tests on BrowserStack App Automate.

A PAC file lets you define rules that decide which requests go through a proxy and which connect directly. When your network relies on a PAC file, you can point the Local binary to it so that your Detox tests resolve traffic the same way. The following section explains how to establish a Local Testing connection using a PAC file, along with a sample file for reference.

PAC (Proxy Auto-Configuration)

PAC file (Proxy auto-configuration file) contains a JavaScript function that determines whether a request should be sent via the proxy server. Once you have the absolute path of the PAC file on your machine, you can establish a Local Testing connection using the command line.

Via command-line interface:

Establish the Local Testing connection using --pac-file flag, along with the PAC file’s absolute path.

Run the binary using the following command:

Copy icon Copy
Copy icon Copy

BrowserStack does not currently support authentication with a PAC file.

To resolve all requests on our remote browsers and mobile devices through your PAC proxy, add --force-proxy and --force-local flags to the command.

Without these flags, Local binary tries to connect directly for enhanced performance.

Sample PAC file

The following function checks to see whether the hostname is localhost, and if so, whether the connection is direct. If the hostname is not localhost, the connection is via proxy.

Copy icon Copy

If you don’t understand the proxy script or are not authorized to make any changes to it, contact your IT or network team.

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