-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
I've an authenticated API and with playwright I've a function like this:
const newBrowserPageFromApi = async ({ browser, api }: { browser: Browser, api: APIRequestContext }): Promise<Page> => {
const storageState = await api.storageState();
const apiContext = await browser.newContext({ storageState });
return await apiContext.newPage();
};
That creates a new page authenticated using the already authenticated API for browsing purposes and saves me to use the logic to enter the login + password. It works perfectly when used directly in playwright but fails when using it through browserstack. The error is:
1) [chrome-latest:Windows 11-browserstack] › extensions/wow_ecommerce/tests/admin/config/wow_ecommerce_config.spec.ts:18:7 › WowEcommerce Admin > Config > Wow Ecommerce › Config can be saved
Error: browser.newContext: Error: Unknown scheme for Initializer: Selectors.
at ../composables/api/useWowApiTools.ts:7
5 | const storageState = await api.storageState();
6 | console.log('storageState', storageState);
> 7 | const apiContext = await browser.newContext({ storageState });
| ^
8 | return await apiContext.newPage();
9 | };
10 |
I couldn't find anything in playwright related to this and it works directly in playwright so I think this is specific to the browserstack integration. Information:
platforms:
- os: Windows
osVersion: 11
browserName: chrome
browserVersion: latest
Activity
phproberto-bluebox commentedon Jun 26, 2025
Update: I've found the issue comparing this repository with our setup. The tests were failing with even the most basic test like just loading google. Not related to the fact that I'm inheriting localStorage.
It turns out that you cannot use the latest version of playwright. Tests passing within this repo show this information:
And tests failing in our setup with exactly the same config:
So the only difference was the playwright version. I checked your package-lock.json file and has a forced version:
So even using
"@playwright/test": "latest",
in your package.json the used version is always1.40.1
. I forced our system to use that version and then the error was gone. So I think you should know that the SDK does not work with current playwright versions.[imp][browserstack#43] update playwright & browserstack versions to t…
phproberto commentedon Jun 30, 2025
I've sent a pull request to increase the playwright repo version to v1.52.0 which is the latest one working with the browserstack SDK. Current version (v1.40.0) is from 2023.
#44