Configure your Proxy Settings

Proxy

Proxies are commonly set up for office networks, remote servers, and sometimes on local machines. Contact your network/IT team to obtain the ‘Proxy Host’ and ‘Proxy Port’ to setup Local Testing for this implementation. Once you obtain the Host and Port, you can establish a Local Testing connection using one of two ways:

Via language bindings:

Add the following snippet to your test scripts:

bsLocalArgs.put("proxyHost", "127.0.0.1");
bsLocalArgs.put("proxyPort", "8000");

If your proxy requires authentication, use the following code snippet:

bsLocalArgs.put("proxyHost", "127.0.0.1");
bsLocalArgs.put("proxyPort", "8000");
bsLocalArgs.put("proxyUser", "user");
bsLocalArgs.put("proxyPass", "password");

Via command-line interface:

Use the --proxy-host and --proxy-port flags while establishing a Local Testing connection:

Run the binary using the following command:

./BrowserStackLocal --key YOUR_ACCESS_KEY --proxy-host  --proxy-port
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --proxy-host  --proxy-port

If your proxy requires authentication, add --proxy-user and --proxy-pass to the above command.

Run the binary using the following command:

./BrowserStackLocal --key YOUR_ACCESS_KEY --proxy-host  --proxy-port  --proxy-user --proxy-pass
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --proxy-host  --proxy-port  --proxy-user --proxy-pass

To resolve all requests on our remote browsers and mobile devices through your proxy, add --force-proxy and --force-local flags to the command. Without these flags, Local binary tries to connect directly for better performance.

MITM Proxy

If your proxy type is MITM (like BrowserMob), you will need the ‘Proxy Host’ and ‘Proxy Port’. Once you have the Host and Port, you can establish a Local Testing connection using one of two ways:

Via language bindings:

Add the following snippet to your test scripts:

bsLocalArgs.put("localProxyHost", "127.0.0.1");
bsLocalArgs.put("localProxyPort", "8000");

If your proxy requires authentication, use the following code snippet:

bsLocalArgs.put("localProxyHost", "127.0.0.1");
bsLocalArgs.put("localProxyPort", "8000");
bsLocalArgs.put("-localProxyUser", "user");
bsLocalArgs.put("-localProxyPass", "password");

Via command-line interface:

Use the following command to establish the Local Testing connection:

Run the binary using the following command:

./BrowserStackLocal --key YOUR_ACCESS_KEY --local-proxy-host <proxy_host> --local-proxy-port <proxy_port> 
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --local-proxy-host <proxy_host> --local-proxy-port <proxy_port>

If your local proxy requires authentication, add --local-proxy-user and --local-proxy-pass to the above command.

./BrowserStackLocal --key YOUR_ACCESS_KEY --local-proxy-host <proxy_host> --local-proxy-port <proxy_port> --local-proxy-user <proxy_user> --local-proxy-pass <proxy_pass>
BrowserStackLocal.exe --key YOUR_ACCESS_KEY --local-proxy-host <proxy_host> --local-proxy-port <proxy_port> --local-proxy-user <proxy_user> --local-proxy-pass <proxy_pass>

To resolve all requests on our remote browsers and mobile devices through your local proxy, add --force-proxy and --force-local flags to the command. Without these flags, Local binary tries to connect directly for enhanced performance.