Select Playwright Version

A guide to selecting the Playwright version for running your automated tests using BrowserStack Automate

Important: Playwright testing on BrowserStack (beta) is not available to all users yet. If you’d like to get access, please submit a request here.

Why selecting a Playwright version is necessary?

Playwright tests on BrowserStack work using the client-server architecture where the client sits on your machine / CI machine through which you are invoking the tests. And, the Playwright server sits on the BrowserStack cloud.

Based on the Playwright server version, the associated bundled browser version would be used for testing. For e.g. if the Playwright server version is v1.14.0, and you want to test using playwright-chromium, then that would mean that Chromium 94 would be used for testing. Similarly, the bundled browser version of playwright-webkit and playwright-firefox with that specific Playwright version would be used.

You can read more about the supported browser versions and select the version you want.

What are the different Playwright server versions available on BrowserStack?

At the moment, BrowserStack supports two Playwright versions. The default Playwright version is v1.11.1 and the other supported version is v1.10.0.

You can have any Playwright version installed on your system and that should work fine with any of the server versions that are supported on BrowserStack. You just need to ensure that client.playwrightVersion capability is passed in all your tests with the value of the version that is installed on your system. (This is shown in all of our sample scripts that can be found in the GitHub repository).

Selecting Playwright version and its repercussions

If you do not specify any Playwright version for your tests, we would be default run your test on the most latest version that is available on our platform. However, there is an option through which you can specify the Playwright that you want to use.

You can specify the required Playwright version using the capability browserstack.playwrightVersion. It accepts absolute values like 1.11.1, 1.10.0 etc. But we do not recommend you to specify hardcoded Playwright versions for your tests for the simple reason that you would constantly need to update your test code based on the version releases on our platform.

Instead we accept values like 1.latest and 1.latest-1 to specify the latest and latest-1 minor versions within the major version 1 respectively. See the example below to see how to specify the capability in a real setting:

const { chromium } = require('playwright');

const cp = require('child_process');
const clientPlaywrightVersion = cp.execSync('npx playwright --version').toString().trim().split(' ')[1];  // To know the client side playwright version installed on your system

(async () => {
    const caps = {
        'browser': 'playwright-chromium',  // allowed browsers are `chrome`, `edge`, `playwright-chromium`, `playwright-firefox` and `playwright-webkit`
        'client.playwrightVersion': clientPlaywrightVersion,

        'browserstack.playwrightVersion': '1.latest-1',  // Specifying the Playwright server version to be used on BrowserStack as the 2nd most recent available version on BrowserStack

        'browserstack.username': process.env.BROWSERSTACK_USERNAME || 'YOUR_USERNAME',
        'browserstack.accessKey': process.env.BROWSERSTACK_ACCESS_KEY || 'YOUR_ACCESS_KEY',
    };
    const browser = await chromium.connect({
        wsEndpoint: `wss://cdp.browserstack.com/playwright?caps=${encodeURIComponent(JSON.stringify(caps))}`,
    });
    const page = await browser.newPage();
    await page.goto('https://www.google.com/ncr');
    await browser.close();
})();

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert