Skip to content

[Question]: How to get the right BrowserType from a device name?  #1496

@Rafiot

Description

@Rafiot

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:

playwright open --device="Desktop Safari" wikipedia.org  # Webkit
playwright open --device="Desktop Firefox" wikipedia.org  # Firefox
playwright open --device="Desktop Chrome" wikipedia.org  # Chrome

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 as playwright open can already do that, that seems superfluous.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions