Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.19 KB

File metadata and controls

57 lines (40 loc) · 1.19 KB

polyfill.screen

Tip

This plugin is enabled in the ⭐️ recommended.

Set a realistic value for screen size: 1920x1080.

Options

This plugin supports the following options:

  • width (default 1920): Screen width.
  • height (default 1080): Screen height.

Examples

Use the plugin with default options.

import { chromium } from "playwright-ghost";
import plugins from "playwright-ghost/plugins";

const browser = await chromium.launch({
  plugins: [plugins.polyfill.screen()],
});
// ...

Use the plugin and specify a screen size of 2560x1440.

import { chromium } from "playwright-ghost";
import plugins from "playwright-ghost/plugins";

const browser = await chromium.launch({
  plugins: [plugins.polyfill.screen({ width: 2560, height: 1440 })],
});
// ...

Advanced

Import

If you want to import only this plugin, you can use the "playwright-ghost/plugins/polyfill/screen" path in the import.

import { chromium } from "playwright-ghost";
import polyfillScreenPlugin from "playwright-ghost/plugins/polyfill/screen";

const browser = await chromium.launch({
  plugins: [polyfillScreenPlugin()],
});
// ...