Skip to main content
BrowserStack now allows you to run Playwright tests on android devices. To get started click here

Specify a Playwright version

Learn how to set the supported Playwright version in your Playwright tests.

BrowserStack detects the browser and browser_version from the capability set in your test script and selects the appropriate Playwright version. If the browser_version is not specified, the Playwright version used will be the same as the Playwright client version. If you have a use case where you need to set the Playwright version explicitly, only then consider using the browserstack.playwrightversion capability in your test script.

In this guide, you will learn about:

How BrowserStack sets Playwright version

BrowserStack uses the following order of precedence to decide which Playwright version to use:

Playwright Version Selection Workflow

  1. If the browser_version capability is set, the Playwright version that supports this browser is selected.
  2. If the value set in the browser_version capability is supported by multiple Playwright versions, BrowserStack checks your Playwright client version and sets the Playwright version accordingly.
  3. If the browser_version is not set and the Playwright client version is detected, the Playwright version used will be the same as the client version.
  4. If both the browser_version and the Playwright client version are not detected, either the version number passed in the browserstack.playwrightversion capability is used, if set, or the latest Playwright version is used.
  1. If the browserstack.playwrightVersion capability is specified, BrowserStack will select the specified version.
  2. If the browserstack.playwrightVersion capability is not specified, the Playwright version selected will be same as the client version.

Set the Playwright version

If you must set the Playwright version explicitly, set the browserstack.playwrightVersion key to the required version in your test script.

Capability Description Possible values
browserstack.playwrightVersion Set the required Playwright version. 1.latest to run tests on the latest version.

To use older versions, use 1.latest-1, 1.latest-2, and so on.

You can also explicitly set the version to 1.31.
Note: Check out the Playwright-browser compatibility section to know which compatible browsers you can use to run your Playwright tests.

The following sample code snippet sets the Playwright version to 1.latest:

// fixtures.js

const caps = {
    'browser': 'playwright-webkit',
    'os': 'os x',
    'os_version': 'catalina',
    'browserstack.playwrightVersion': '1.latest'
  };
// sample.js

const caps = {
    'browser': 'playwright-webkit',
    'os': 'os x',
    'os_version': 'catalina',
    'browserstack.playwrightVersion': '1.latest'
  };
// sample.java

JsonObject capabilitiesObject = new JsonObject();
capabilitiesObject.addProperty("browser", "playwright-webkit");
capabilitiesObject.addProperty("browserstack.playwrightVersion", "1.latest");
capabilitiesObject.addProperty("os", "osx");
capabilitiesObject.addProperty("os_version", "catalina");
# sample.py

desired_cap = {
  'browser': 'playwright-webkit',
  'browserstack.playwrightVersion': '1.latest',
  'os': 'osx',
  'os_version': 'catalina',
}
// sample.cs
 {
 using var playwright = await Playwright.CreateAsync();
    Dictionary<string, string> browserstackOptions = new Dictionary<string, string>();   
    browserstackOptions.Add("os", "osx");
    browserstackOptions.Add("os_version", "catalina");
    browserstackOptions.Add("browser", "playwright-webkit");
    browserstackOptions.Add("browserstack.playwrightVersion", "1.latest")
 }   

Need some help?

If you have a use case where you need to use a Playwright version other than the ones we support, please reach out to our Support team.

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