Create Distinct Session with Automate Playwright SDK
Why does Playwright SDK on BrowserStack not creat distinct sessions and varies with workers or parallelsPerPlatform?
Playwright creates sessions equal to the number of workers (parallelsPerPlatform * number of platforms) defined with or without SDK. Playwright creates the following three objects to maintain browser lifecycles for each worker:
- Chrome Debugging Protocol (CDP) Connection (For BrowserStack): By default, the same connection is reused in the same worker thread.
- BrowserContext: By default, a new context is created for each test.
- Page
For example, if there are 8 tests (T) and 4 workers (W), Playwright spawns 4 worker threads (=W) and distributes T between W. The connection to BrowserStack is the same in each W, so 4 sessions are created on BrowserStack in this case.
With SDK the workers created are PPP * number of platforms. Depending on the PPP, the number of sessions on BrowserStack varies.
To create distinct sessions on BrowserStack, use the following custom test fixture:
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
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!