Skip to main content

Sauce Labs Browsers

You can use Eggplant Gateway to provide the connections to browsers in the Sauce Labs cloud for your Eggplant Functional and DAI tests to run against.

info

Eggplant Functional 22.3 (or later) has built-in support for Sauce Labs Browsers. You do not need to use Eggplant Gateway to connect to Sauce Labs browsers using these versions of Eggplant Functional. See the Eggplant Functional documentation for more information.

Getting Started

Before you can use Eggplant Gateway for Sauce Labs Browsers, you'll need:

Creating a Connection

To set up a connection to a browser in the Sauce Labs Cloud, run the following command:

./epgw add sauce-browser \
--name <name> \
--user <user> \
--apiKey <apiKey> \
--dataCenter <dataCenter> \
--platformName <platformName> \
--browserName <browserName> \
--browserVersion <browserVersion> \
--screenResolution <screenResolution> \
--url <url>

The available options are:

KeyDescription
nameThe name of the connection you want to create. You can freely choose this name.
userYour Sauce Labs user name. For example, awesome-user.
apiKeyYour Sauce Labs API key (also referred to as Access Key). For example, 33b6cc9e-1cba-4e1e-84d3-eb2a24f5ea28.
dataCenterThe Sauce Labs data center you want to use. For example, us-west-1 or eu-central-1.
platformNameThe platform you want to use. Is Windows 10 by default.
browserNameThe browser name. Is chrome by default.
browserVersionThe browser version. Is 98 by default.
screenResolutionThe screen resolution. Is 1400x1050 by default.
urlThe URL to navigate to when the browser launches.

For example, the following command creates a connection which will launch Chrome and navigate to https://www.google.com:

./epgw add sauce-browser \
--name chrome \
--user sauce_user \
--apiKey awesome_key \
--dataCenter eu-central-1 \
--browserName chrome \
--url https://www.google.com
warning

SauceLabs Browser and Virtual Device connections have a time limit of 3 hours. Once the 3 hours have elapsed, SauceLabs will forcibly close the connection.

Connecting to Eggplant Functional

To provision a browser in the Sauce Labs Cloud and use it through Eggplant Functional, follow these steps:

  1. Start Eggplant Functional
  2. Run epgw connect <name>, where name is the name of your Gateway connection.
    For example, epgw connect chrome

The Eggplant Gateway will now provision your browser in the Sauce Labs Cloud and add it to the connection list in Eggplant Functional.

Setting up a VNC and WebDriver Server for Your Browser

Alternatively, you can set up a VNC and WebDriver server for your server. To do so, you can either:

  1. Run epgw vnc <name>, where name is the name of your Gateway connection. For example, epgw vnc chrome

    The Eggplant Gateway will now provision your browser in the Sauce Labs cloud and start:

    • A VNC server at port 5900
    • A WebDriver server at port 5000

    You'll need to manually add your device to the connection list in Eggplant Functional.

  2. Run multiple Eggplant Gateways simultaneously.

You can specify a custom VNC port and WebDriver port to run multiple Eggplant Gateway instances using the vncPort and webDriverPort keys:

KeyDescription
vncPortThe custom VNC port. The Eggplant Gateway starts a VNC server at the given vncPort.
webDriverPortThe custom WebDriver port. The Eggplant Gateway starts a WebDriver server at the given webDriverPort.

For example, epgw vnc chrome --vncPort 5901 --webDriverPort 5001