Rayrun
← Back to Discord Forum

How to get browser version from multiple browsers

Hello everyone!

You can get browser version with browser.version(), but this is usually in an example where we're launching browser, like const browser = await firefox.launch();. How can I get browser version if I'm using the default playwright setup, meaning tests are executed in browsers specified in projects in playwright.config.ts file? I want to be able to get that browser version, as I'd like to pass it to report afterwards (allure)

This thread is trying to answer question "How can I get browser version if I'm using the default playwright setup, meaning tests are executed in browsers specified in `projects` in `playwright.config.ts` file?"

3 replies
ibrahim.bektas
ibrahim.bektas

You can go to node_modules playwright-core -> browsers.json there are listed the versions of the browsers

but if I want to be able to get the browser version and pass it further, e.g. to allure report, how can I do that?

ibrahim.bektas
ibrahim.bektas

you can do it in the Fixtures as well . I launch the browser always from fixtures (using the cokies) you can reach the version method from there.

Answer

Determining Browser Version in Playwright

First, you need to check the version of Playwright installed in your project. Open your terminal, navigate to your project directory, and run the following command:

npx playwright --version

This command will display your installed Playwright version.

Next, open your 'playwright.config.ts' file. Here, you'll find a 'projects' section. Each project represents a different browser or configuration for your tests.

Each project object has a 'name' property, specifying the browser or configuration. For instance, a project named 'chromium' represents tests running on the Chromium browser.

To find out the version of each browser in your projects, you need to know which Playwright version corresponds to each browser. You can find this information in Playwright's release notes.

Remember, Playwright uses open source Chromium builds by default for browsers like Google Chrome and Microsoft Edge. So, when Google Chrome N is released globally, Playwright already supports Chromium N+1. This version becomes available on Google Chrome and Microsoft Edge after a few weeks.

In summary, use npx playwright --version to find your Playwright version. Refer to Playwright's release notes to determine the browser versions used in your 'playwright.config.ts' projects.

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].