BrowserConnection Object

A connection to a remote browser.

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

You can create a new BrowserConnection with the testCafe.createBrowserConnection function.

The browserConnection.url property returns a URL. Remote browsers can use this URL to connect to a TestCafe server instance.

When the remote browser establishes connection, the browserConnection.opened 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 the remoteConnection.url to allow access from a remote browser.

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

    await testcafe.close();