Skip to content
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

[BUG] Device emulation not working with CLI #6431

Closed
transplatin opened this issue May 6, 2021 · 5 comments
Closed

[BUG] Device emulation not working with CLI #6431

transplatin opened this issue May 6, 2021 · 5 comments
Assignees

Comments

@transplatin
Copy link

transplatin commented May 6, 2021

Device emulation not working with CLI

Context:

  • Playwright Version: 1.10.0
  • Operating System: Windows 10
  • Node.js version:v14.16.1
  • Browser: Playwright Default

System:

  • OS: Windows 10 10.0.19042
  • Memory: 1.74 GB / 5.88 GB

Binaries:

  • Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
  • npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD

npmPackages:

  • playwright: ^1.10.0 => 1.10.0

Code Snippet

I tried to emulate iPhone 11 using CLI but it is not working.

npx playwright open --device="iPhone 11" wikipedia.org

Error
'''
Device descriptor not found: 'iPhone', available devices are:
"Blackberry PlayBook"
"Blackberry PlayBook landscape"
"BlackBerry Z30"
"BlackBerry Z30 landscape"
"Galaxy Note 3"
"Galaxy Note 3 landscape"
"Galaxy Note II"
"Galaxy Note II landscape"
"Galaxy S III"
and so on...

Possible Issue

It seems like it is only accepting the first word of every specified device rather than accepting it as "iPhone 11", it is accepting it as "iPhone".

@transplatin transplatin changed the title [BUG] [BUG] Device emulation not working with CLI May 6, 2021
@mxschmitt
Copy link
Member

I tried to reproduce it with Windows with Powershell and cmd.exe and it worked for me as expected in both cases. (I had Node.js 16 but this should not make a big difference there.)

Are you using some special terminal e.g.?

@transplatin
Copy link
Author

transplatin commented May 6, 2021

I am using the command prompt.

Capture

Same issue with git bash as well.

Capture

@aslushnikov aslushnikov self-assigned this May 7, 2021
@aslushnikov
Copy link
Collaborator

I can repro on one of our windows machines; looking into it!

@aslushnikov
Copy link
Collaborator

So turns out this is an NPX issue on Windows:

This, however, is fixed in NPM v7, so that's why @mxschmitt wasn't able to reproduce.

@transplatin: the official "workaround" for this would be to install NPM v7:

$ npm i -g npm@v7

Worked for me! So closing this.

@transplatin
Copy link
Author

Yes, updating to npm@7 solves the issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants