Open
Description
When i trying "Legacy Integration" with my tests wrote on "NodeJS/Playwright", when i trying connect via wssEndpoint getting such issue "Error: browserType.connect: Target page, context or browser has been closed".
test('Authentication Test', async ({}) => {
const caps = {
osVersion: "13.0",
deviceName: "Samsung Galaxy S23", // "Samsung Galaxy S22 Ultra", "Google Pixel 7 Pro", "OnePlus 9", etc.
browserName: "chrome",
realMobile: "true",
name: "My android playwright test",
build: "playwright-build-1",
"browserstack.username": "userName",
"browserstack.accessKey": "password",
"browserstack.local": true,
}
let vBrowser = await playwright.chromium.connect({
wsEndpoint:
`wss://cdp.browserstack.com/playwright?caps=` +
`${encodeURIComponent(JSON.stringify(caps))}`,
});
let vContext = await vBrowser.newContext();
const page = await vContext.newPage();
await test.step("Login Test", async () => {
await Login(page, config);
})
Activity
Rokandor commentedon Apr 9, 2024
I am also facing this issue
Error:Target page, context or browser has been closed
And it happens randomly as well without more details
Schmidt-N commentedon May 15, 2024
I had the same problem, but was able to reconstruct it, I had used the 'BuildTag' which is also allowed in the documentation(https://www.browserstack.com/docs/automate/playwright/organize-tests). However, after including it, it caused exactly this error. Therefore I think that this error always appears when the configurations of the tests do not fit.