Runner.browsers Method

Configures the test runner to run tests in the specified browsers.

browsers(browser) → this

The browser parameter can be any of the following objects or an Array of them:

Parameter Type Description Browser Type
String | Array A different browser alias for each browser type. See Browser Support for more details. Local browsers, cloud browsers, and browsers accessed through browser provider plugins.
{path: String, cmd: String} The path to the browser's executable (path) and command line parameters (cmd). The cmd property is optional. Local and portable browsers
BrowserConnection The remote browser connection. Remote browsers

You do not need to call this function if you specify the browsers property in the configuration file.

Related configuration file property: browsers

Use Browser Aliases

You can identify locally installed browsers with predefined browser aliases:

runner.browsers(['safari', 'chrome']);

You can also use aliases to run browsers accessed with provider plugins, such as browsers in cloud testing services:

runner.browsers('saucelabs:Chrome@52.0:Windows 8.1');

Specify the Path to the Browser Executable

To specify the path to the browser executable, use the path: prefix. Enclose the path in backticks if it contains spaces:

runner.browsers('path:`C:\\Program Files\\Internet Explorer\\iexplore.exe`');

Specify the Path With Command Line Parameters

    path: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
    cmd: '--new-window'

Headless Mode, Device Emulation and User Profiles

You can add postfixes to browser aliases to run tests in the headless mode, use Chrome device emulation or user profiles:


For portable browsers, use the browser alias followed by the path to an executable:


The path: prefix does not support postfixes.

Combining :userProfile flag with either headless or emulation mode can lead to unstable behaviour and is not recommended.

Pass a Remote Browser Connection

const createTestCafe = require('testcafe');

const testcafe         = await createTestCafe('localhost', 1337, 1338);
const runner           = testcafe.createRunner();
const remoteConnection = await testcafe.createBrowserConnection();

// Outputs remoteConnection.url so that it can be visited from the remote browser.

remoteConnection.once('ready', async () => {
    const failedCount = await runner

    await testcafe.close();