- The Platform Configurator
- Getting Started with Selenium for Automated Website Testing
- Getting Started with Appium for Mobile Native Application Testing
- Selenium Bootcamp by Dave Haeffner
- Appium Bootcamp by Dave Haeffner and Matthew Edwards
The Sauce Connect proxy setup is for situations in which there is a proxy server between the Internet and the machine hosting Sauce Connect, or between the machine hosting Sauce Connect and the machine hosting the website you want to test. In these cases you will want to use the Sauce Connect proxy commands to configure the proxy host and port that Sauce Connect can use to either reach the Internet or the site you want to test.
Sauce Connect and MitM Proxies
If you use a Man-in-the-Middle proxy to monitor network traffic, it must be configured to allow the TLS connection and proprietary protocol that Sauce Connect uses to communicate with the Sauce Labs virtual machines that are running your tests. If it will allow only HTTP or HTTPS sessions, it will drop the inbound Sauce Connect connection. Check out Sauce Connect Start Up and Tear Down Process for more information about how Sauce Connect starts up and maintains the connection with the Sauce Labs browser cloud.
Internet Control/Transaction Monitoring with a Proxy Configuration
You may have a network configuration in which you use a proxy to control the flow of traffic from your internal network to the external Internet, either as a means of adding security to your network, or whitelisting or blacklisting certain sites. In this situation you could set up Sauce Connect behind a proxy like BrowserMob, which records all traffic that passes through it, and which can later provide a history of that traffic.
Proxied Site Under Test (SUT)
In this configuration the SUT is behind a proxy, to allow even more control over traffic before it reaches the SUT. Typical this setup is used to control access to the SUT by means of IP whitelisting, or requiring a username and password to access the proxy.
|SC Host||Machine in your network that the Sauce Connect application is running on.|
|SUT||Site Under Test, the site that you're testing.|
The virtual machine that hosts Sauce Connect on the Sauce Labs side.
Different Machine, But Same Network
The most important thing to understand about setting up Sauce Connect is that while it doesn't need to be set up on the same machine as the site or application you're testing, it must be on the same network. What Not to Do: Dysfunctional Sauce Connect Proxy Network Configurations illustrates some examples of network architectures in which Sauce Connect will not be able to create a tunnel, or will be too slow to carry out effective testing.
Sauce Connect IP and Virtual Machine Range
220.127.116.11/21(this is equivalent to the range
18.104.22.168 – 22.214.171.124)
126.96.36.199/21(this is equivalent to the range
188.8.131.52 - 184.108.40.206)
220.127.116.11/22(this is equivalent to the range
18.104.22.168 - 22.214.171.124)
For saucelabs.com certificate authentication, the server hosting Sauce Connect may need to connect to Online Certificate Status Protocol (OCSP) or Certificate Revocation List (CRL) services as well. Check out Sauce Connect Certificate Handling for more info.
IP Ranges and Data Center Endpoints
Sauce Labs has data centers in both the US and EU. You can access Sauce Labs services from either location by providing the appropriate URL endpoints, and whitelisting their associated IP ranges.
Virtual Device Cloud: https://ondemand.eu-central-1.saucelabs.com/wd/hub
Sauce Connect Proxy: https://eu-central-1.saucelabs.com/rest
REST API: https://eu-central-1.saucelabs.com/rest/v1
126.96.36.199/21 (this is equivalent to the range
188.8.131.52 – 184.108.40.206)
220.127.116.11/21 (this is equivalent to the range
18.104.22.168 - 22.214.171.124)
- Make sure you've reviewed the System Requirements for Sauce Connect Proxy
- You should read Sauce Connect and Network Security to understand how Sauce Connect uses tunnels to connect your site or application under test to a browser running on a virtual machine in the Sauce Labs data center, and to understand how that tunnel is secured
- You should review the Sauce Connect Best Practices and Sauce Connect Proxy FAQS
Setting Up Sauce Connect
Download the appropriate version of Sauce Connect for your operating system.Latest Stable Release
Download Link SHA1 Checksum Download Sauce Connect v4.5.2 for Mac OS 10.8+
Download Sauce Connect v4.5.2 for Windows 7+
Download Sauce Connect v4.5.2 for Linux
Download Sauce Connect v4.5.2 for Linux 32-bit
57dba5324515157f0954ef47871a9963b2f5fc8eClick here to download past stable releases of Sauce Connect Proxy...
Download Link SHA1 Checksum Download Sauce Connect v4.5.1 for Mac OS 10.8+
Download Sauce Connect v4.5.1 for Windows 7+
Download Sauce Connect v4.5.1 for Linux
Download Sauce Connect v4.5.1 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.5.0 for Mac OS 10.8+
Download Sauce Connect v4.5.0 for Windows 7+
Download Sauce Connect v4.5.0 for Linux
Download Sauce Connect v4.5.0 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.11 for OS X 10.12+
Note: Contains a major bug on OS X 10.11 and below, please use SC 4.4.12 instead.
Download Sauce Connect v4.4.11 for Windows 7+
Download Sauce Connect v4.4.11 for Linux
Download Sauce Connect v4.4.11 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.10 for OS X 10.8+
Download Sauce Connect v4.4.10 for Windows 7+
Download Sauce Connect v4.4.10 for Linux
Download Sauce Connect v4.4.10 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.9 for OS X 10.8+
Download Sauce Connect v4.4.9 for Windows 7+
Download Sauce Connect v4.4.9 for Linux
Download Sauce Connect v4.4.9 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.8 for OS X 10.8+
Download Sauce Connect v4.4.8 for Windows 7+
Download Sauce Connect v4.4.8 for Linux
Download Sauce Connect v4.4.8 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.7 for OS X 10.8+
Download Sauce Connect v4.4.7 for Windows 7+
Download Sauce Connect v4.4.7 for Linux
Download Sauce Connect v4.4.7 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.6 for OS X 10.8+
Download Sauce Connect v4.4.6 for Windows 7+
Download Sauce Connect v4.4.6 for Linux
Download Sauce Connect v4.4.6 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.5 for OS X 10.8+
Download Sauce Connect v4.4.5 for Windows 7+
Download Sauce Connect v4.4.5 for Linux
Download Sauce Connect v4.4.5 for Linux 32-bit aa42f7d16a59474efd950c604f996bdcc2d45544
Download Link SHA1 Checksum Download Sauce Connect v4.4.4 for OS X 10.8+
Download Sauce Connect v4.4.4 for Windows 7+
Download Sauce Connect v4.4.4 for Linux
Download Sauce Connect v4.4.4 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.3 for OS X 10.8+
Download Sauce Connect v4.4.3 for Windows 7+
Download Sauce Connect v4.4.3 for Linux
Download Sauce Connect v4.4.3 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.2 for OS X 10.8+
Download Sauce Connect v4.4.2 for Windows 7+
Download Sauce Connect v4.4.2 for Linux
Download Sauce Connect v4.4.2 for Linux 32-bit
Download Link SHA1 Checksum Download Sauce Connect v4.4.1 for OS X 10.8+
Download Sauce Connect v4.4.1 for Windows 7+
Download Sauce Connect v4.4.1 for Linux
Download Sauce Connect v4.4.1 for Linux 32-bit
- On the machine where you want to install Sauce Connect, open outbound port 443 for sending Selenium commands from Sauce Connect to the Sauce Labs virtual machine, and inbound port 4445 for receiving Selenium commands (inbound port 4445 only needs to be open for connections within your network from the machine where your test scripts are running, and only if you use Sauce Connect's Selenium Relay, which by default listens on port 4445).
After extracting the Sauce Connect files onto your machine, go to the install directory and run the -u and -k commands to authenticate against your Sauce Labs account and establish the Sauce Connect tunnel.
Finding Your Username and Access KeyYou can find your Sauce Labs username and access key in the User Profile > User Settings section of your Sauce Labs dashboard. You should also check out our topic on setting your username and access key as environment variables.
- When you see
connected, log in to your Sauce Labs account and click the Tunnels dashboard link.
Under Active Tunnels, you should see the tunnel you just started.
Using the tunnelIdentifier Option for Automated Tests
Once you have launched a Sauce Connect Proxy tunnel, you need to use the
tunnelIdentifier option in the desired capabilities of your automated tests to run your tests through that tunnel. For example, if your tunnel is named
myTunnel01, you would need to set this option as
"tunnelIdentifier": "myTunnel01". If you are starting and stopping Sauce Connect Proxy programmatically, you can make sure your tunnel always launches with the same name by passing the identifier flag,
-i, with your authentication credentials, for example:
bin/sc -u YOUR_USERNAME -k YOUR_ACCESS_KEY -i myTunnelO1
You now have three options for proxy configuration:
Automatic Proxy Configuration
As of Sauce Connect 4.3.1, proxies and PAC settings are autoconfigured based on the settings of the operating system on the machine where it is installed.
- On Windows, Sauce Connect will use the proxy settings for Internet Explorer, as well as the system-wide proxy settings that set in the Control Panel.
- On Mac OS X, Sauce Connect will use the proxy settings in Preferences/Network. Both proxy and PAC settings are supported.
- On Linux, Sauce Connect looks for these variables, in this order:
ALL_PROXY.They can be in the form
You can disable automatic proxy detection with the command line option
Command Line Configuration
If automatic proxy configuration fails, you need to override the settings, or you need to enable proxies through a test script, there are several command-line options that you can use to configure proxies manually.
Why are there -p, --proxy and a -T, --proxy-tunnel options?
Fundamentally, Sauce Connect makes two separate outbound connections for two separate purposes. The first, which
-p, --proxy <host:port> uses, is a lightweight connection to our REST API that simply tells our servers basic information about the status of Sauce Connect's status (for example, starting up, ready, stopping).
The second connection is to the actual tunnel virtual machine (VM) created for your Sauce Connect instance. Enabling the
-T, --proxy-tunnel flag will cause some proxy specified with
-p, --proxy to be used for this connection as well. You should try to avoid using a proxy for this connection, since it is already TLS secured, and a large volume of data tends to go over this connection. Adding another step in the middle, in the form of a proxy, can hinder test performance.
Ideally you should only need to use
-p, --proxy <host:port> (and perhaps
-w, --proxy-userpwd <user:pwd> for credentials), but
-T, --proxy-tunnel is available if your network doesn't allow outgoing connections on port
443. If your tests are slow, you may want to ask your network administrator about making an exception for this connection.
BrowserMob Proxy Configuration
You can use BrowserMob Proxy with Sauce Connect 4.2 and higher by using the Sauce Connect PAC feature.
Since BrowserMob bumps SSL connections, and Sauce Connect 4 verifies the certificate when connecting to the REST API, that means the
--proxy option can't be used with a BrowserMob proxy. Sauce Connect will complain that the certificate received from the REST endpoint is invalid.
To choose a proxy in a dynamic fashion, however, you can create a PAC file that matches the REST and tunnel VM hostnames, and uses the local BrowserMob proxy for everything else.
Start BrowserMob Proxy.
Start another terminal and create a proxy instance in BrowserMob.
Create a file,
browsermob.js, with this content.
This is what you will pass into Sauce Connect 4.
Copy the file to the same directory as Sauce Connect 4, and start Sauce Connect 4.
Sauce Connect 4 will print the proxy used for REST and the tunnel VM connection, which should be
Using no proxy for connecting to Sauce Labs REST APIand
Using no proxy for connecting to tunnel VMif their hostnames are configured with DIRECT access.
You can use WonderProxy for GeoIP website testing with Sauce Connect. Check out the step-by-step setup guide on the WonderProxy website.
After Setting Up Sauce Connect
- You can set up monitoring for your Sauce Connect tunnels
Command Line Examples
In its simplest form, Sauce Connect can be started from the command line with these commands.
Starting Sauce Connect Programmatically
To start Sauce Connect programmatically, there are many options, such as launching it via Maven when using Java. The Sauce Connect Maven plugin will do this for you automatically, and you can also check out an example of how to set this up in a testing script.