Playwright: Device Descriptor

  • Playwrightで事前定義されている、デバイスの事前定義セット
  • 「Desktop Chrome」「iPhone 15」「Pixel 7」など100種類以上
    • 実態はJSON
  • Playwrightから外部ページ(e.g. Googleログインページ)にアクセスする際のUAなどを偽装できる
{
  "Desktop Chrome": {
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/.../Safari/537.36",
    "screen": { "width": 1920, "height": 1080 },
    "viewport": { "width": 1280, "height": 720 },
    "deviceScaleFactor": 1,
    "isMobile": false,
    "hasTouch": false,
    "defaultBrowserType": "chromium"
  }
}