Skip to content

Getting error during Legacy Integration my tests #20

Open
@jackshavryhin

Description

@jackshavryhin

Screenshot from 2024-03-12 09-54-26
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

Rokandor commented on Apr 9, 2024

@Rokandor

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

Schmidt-N commented on May 15, 2024

@Schmidt-N

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Schmidt-N@jackshavryhin@Rokandor

        Issue actions

          Getting error during Legacy Integration my tests · Issue #20 · browserstack/node-js-playwright-browserstack