BrowserConnection Object

A connection to a remote browser.

Use this object to run tests on a remote or a mobile device.

BrowserConnection is created with the testCafe.createBrowserConnection function.

The browserConnection.url property returns a URL the remote browser should visit in order to connect to the TestCafe server instance.

When the remote browser establishes connection, the browserConnection.ready event fires. After that, you can pass the BrowserConnection to runner.browsers and start tests.


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', () => {
    const failedCount = await runner

    await testcafe.close();