Sauce Labs Proxy Tunnel Integration

Run TestProject Tests & Jobs on a Sauce Labs proxy tunnel

What is a Sauce Labs proxy tunnel?

Sauce Connect Proxy is a built-in HTTP proxy server that opens a secure "tunnel" connection for testing between a Sauce Labs virtual machine or real device and a web app hosted on your local computer ("localhost") or behind a corporate firewall. It provides a means for Sauce Labs to access your web application.

When is Sauce Connect Proxy Necessary?

Sauce Connect Proxy is required in situations when you run your tests/jobs in TestProject on a web app being tested using Sauce Labs which is on a private network and not publicly accessible. If you will try to test a web app hosted on your local computer ("localhost") or behind a corporate firewall using Sauce Labs, your test will fail, due to this error message:

Setting Up Sauce Labs proxy tunnel Integration


  • TestProject account - In order to enjoy all the features of the TestProject platform, you will need an active TestProject account. If you don't already have one, you can sign up for a free account here.
  • Sauce Labs account - To utilize Sauce Labs cloud you need an account. If you don't already have one, just visit here to create a free trial.
  • Download Sauce Connect Proxy.
  • Open outbound port 443 in your machine

Get Sauce Labs Username & Access Key

In order to setup the integration, you will have to obtain a Sauce Labs Access key. After logging into your Sauce Labs account, visit the setting area (1-2) and copy your User Name (3) and Access Key (4).

Download Latest Version of Sauce Connect Proxy

Under your Sauce Labs account, navigate to TUNNELS tab and get the latest Sauce Connect Proxy for you operating system.

Open outbound port 443 in your machine

In order to enable Sauce Connect Proxy to listen to Selenium commands, we will need to open this port on our machine.
Here’s an example for window 10: Open your Windows Defender Firewall:

Configure Sauce Connect Proxy

After extracting the downloaded Sauce Connect Proxy, go to the install directory and run:
You can also copy an already generated command for you in the Sauce Labs UI under the TUNNELS tab:
Copy/paste and run it using a CMD or a Terminal:
When you see Sauce Connect is up, you may start your tests., go to Tunnels, in Sauce Labs UI after you logged in to your account, Under Active Tunnels, you should see the tunnel you've just started.

Run Recorded Tests from TestProject Platform

TestProject's Agent supports running tests both locally on-premise, and on the cloud. Therefore, you can test private (local) web sites or access local resources such as databases, local directories, APIs, etc.
What happens if you want to achieve the same functionality while utilizing the TestProject virtual agent, executing tests on remote Sauce Labs environments? You can achieve that with TestProject! All you need to do is enable the desired capability while executing your job, according to the following steps:
  • Create a new job by clicking on "Add a new job" button:
  • Drag and drop your test into the job, and configure your job to execute on Sauce Labs:
  • Set the desired capability to this job, that will active the tunnel and enable access to your app:
You can find a tunnel's Name under the "Tunnels" section in your Sauce Labs account.

Run Coded Tests using TestProject OpenSDK

Configure Remote (Cloud) Driver to your Sauce Labs proxy tunnel

By default, TestProject Agent communicates with the local Selenium drivers or Appium server that are bundled within the agent application, then send automatic execution reports to TestProject Dashboard In order to initialize a remote driver for a Sauce Labs proxy tunnel, a custom capability “cloud:URL” and a “tunnelIndetifier” with a given tunnel name should be set.
A basic example of running Selenium tests on remote Sauce Labs servers by utilizing TestProject’s Agent:
import io.testproject.sdk.drivers.web.ChromeDriver;
import io.testproject.sdk.drivers.TestProjectCapabilityType;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setCapability(“tunnelIdentifier”, “{tunnelName}”)”
ChromeDriver driver = new ChromeDriver(chromeOptions);

TestProject Java OpenSDK example for running a test on Windows 10 using multiple browsers:

import io.testproject.sdk.drivers.TestProjectCapabilityType;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public final class WebTest {
public static void main(final String[] args) throws Exception {
RemoteWebDriver driver;
DesiredCapabilities[] browsers = {DesiredCapabilities.firefox(),,DesiredCapabilities.internetExplorer()};
for(DesiredCapabilities browser : browsers){
"https://Meidan:[email protected]");
browser.setCapability("tunnelIdentifier", "TPtunnel");
driver = new RemoteWebDriver("aUV7b3u1F9Bwef5Ze2Dwq63xc8BQj6btBhNj-Lr2HzReiw1", browser );
String s = driver.findElement(By.className("App-header")).getText();
boolean passed = s.contains("Test Automation");
if (passed) {
System.out.println("Test Passed");
} else {
System.out.println("Test Failed");

TestProject Python OpenSDK example for running a test on multiple Operation Systems using Chrome:

from src.testproject.sdk.drivers import webdriver
from import ChromeOptions
def simple_test():
platforms = ['WINDOWS', 'MAC', 'LINUX']
for platform in platforms:
chrome_options = ChromeOptions()
chrome_options.set_capability("cloud:URL", "https://Meidan:[email protected]")
chrome_options.set_capability("tunnelIdentifier", "TP_Proxy_Tunnel")
chrome_options.set_capability('platform', platform)
driver = webdriver.Chrome(token="aUV7b3u1F9B5Ze2Dwq63xc8BQj6btBhNj-Lr2HzReiw1", chrome_options=chrome_options)
a = driver.find_element_by_class_name("App-header").text
passed = "Test Automation" in a
print("Test passed") if passed else print("Test failed")
if __name__ == "__main__":
When you run your coded test locally on your machine, your web app that is not publicly accessible will be reached by your Proxy tunnel, and test reports will be generated automatically to TestProject platform.

Execution Test Reports

Once your coded test execution has been completed, you can hop over to the Reports section in your TestProject account to see the results of your test(s).

Sauce Labs test execution information

Once you click the Open Sauce Labs report link, you will be redirected to Sauce Labs where you will be able to see that your website (that is not publicly accessible) has been reached, with some additional information about that execution: