Using Local Connection via the Command Line

Applies to CrossBrowserTesting SaaS, last modified on January 10, 2023

This page relates to the legacy version of the tunnel that has been introduced to CrossBrowserTesting. If you use the new tunnel version, see Local Testing — Secure Tunnels.

You can create a Local Connection to test against your internal test or QA environments via our Node.js module. It allows you to setup a local connection as part of an automated workflow to test internal Dev or Test sites using Selenium, automated screenshots, or JavaScript unit tests.

View Node.js module instructions at GitHub

We have a Node.js example showing how to start a local connection, run an automated screenshot against an internal resource, then stop the local connection here.


var cbt = require('cbt_tunnels');
var request = require('request');

var authkey = ""; // Place CBT user credentials here
var username = "";

var configObj = {
    authkey: authkey,
    username: username,

var baseUrl = 'https://' + configObj.username + ':' + configObj.authkey + '';"baseUrl: ", baseUrl);

cbt.start(configObj, function(err) {
    if (err) {
        console.error("Error starting: ", err);
        return err;
    var url = baseUrl + 'screenshots?browsers=FF42&check_url=true&hide_fixed_elements=true&';{ url: url }, function(error, response, body) {
        if (error) {
            console.error("Error posting: ", error);
            return error;
                var screenshotTestUrl = baseUrl + 'screenshots/' + JSON.parse(body).screenshot_test_id + '?format=json';
        var areWeThereYet = setInterval(function() {
            request.get({ url: screenshotTestUrl }, function(err, r, b) {
                                if (err) {
                                        console.error("Error retrieving screenshot test data: ", err);
                                        return err;
                if (!JSON.parse(b).versions[0].active) {
                    console.log('Took screenshot!');
                } else {
                    console.log("Are we there yet?");
        }, 3000);

You can also use the Node.js module to start a local connection to use when interactively running tests via the user interface at

Note: The Java tunnel options are deprecated and will not be supported in the near future.

See Also

Testing on a Local Machine
About Local Testing
Testing Behind Your Firewall

Highlight search results