-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: How to get the right BrowserType from a device name? #1496
Comments
You can get it from the |
I can get the settings, but I still need to initialize a browser ( In my case, I want to start from the device name (say |
Gotcha—looks like we are missing the defaultBrowserType property in the devices entries that are available in Node and could be used to programmatically pick |
\o/ nice, thank you! |
For now, you can get the defaultBrowserType from https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json, but it should be exposed on |
Excellent, I'll use the dump for now and switch to that when available. |
@Rafiot Just shipped in v1.25.0 🎉 ! You can use it like the test does: https://github.com/microsoft/playwright-python/pull/1497/files |
Nice, thanks! And thinks for the hint, I didn't know I could get a browser like that: |
Fixes microsoft#1496. Adds tests for documented case, too: https://playwright.dev/python/docs/emulation#devices
Your question
I noticed that the CLI is able to figure out the right
BrowserType
to use when it is launched from the command line:But the documentation seems to say that I have to initialize a
BrowserType
before I can pass the settings to the context, which partially defeats the purpose of the device settings.I can implement my own logic do initialize the right
BrowserType
for each device, but asplaywright open
can already do that, that seems superfluous.The text was updated successfully, but these errors were encountered: