Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

codegen: use device descriptors #41

Closed
arjunattam opened this issue Sep 8, 2020 · 0 comments · Fixed by #44
Closed

codegen: use device descriptors #41

arjunattam opened this issue Sep 8, 2020 · 0 comments · Fixed by #44
Assignees

Comments

@arjunattam
Copy link
Contributor

npx playwright-cli --device="Pixel 2" codegen wikipedia.org

Currently, this is generated as

(async() => {
  const browser = await chromium.launch({
    headless: false
  });
  const context = await browser.newContext({
    userAgent: 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36',
    viewport: {
      width: 411,
      height: 731
    },
    isMobile: true,
    hasTouch: true,
    defaultBrowserType: 'chromium'
  });

It would be great to see this as

(async() => {
  const browser = await chromium.launch({
    headless: false
  });
  const context = await browser.newContext({
   ...devices['Pixel 2']
  });
@arjunattam arjunattam changed the title codegen: use codegen: use device descriptors Sep 8, 2020
@mxschmitt mxschmitt self-assigned this Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants