Tip
This plugin is enabled in the ⭐️ recommended.
Set a realistic value for screen size: 1920x1080.
This plugin supports the following options:
width(default1920): Screen width.height(default1080): Screen height.
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 })],
});
// ...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()],
});
// ...