Skip to content

Latest commit

 

History

History
112 lines (88 loc) · 2.59 KB

File metadata and controls

112 lines (88 loc) · 2.59 KB

recommended

This is a preset for using the recommended plugins:

Options

Plugin options can be provided:

Plugins can be disabled by passing the value to false.

Examples

Use the preset with default options.

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

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

Use the preset and specify polyfill.screen, humanize.click and humanize.cursor plugin options.

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

const browser = await chromium.launch({
  plugins: plugins.recommended({
    polyfill: {
      screen: { width: 2560, height: 1440 },
    },
    humanize: {
      click: { delay: { min: 50, max: 200 } },
      cursor: { start: { x: 100, y: 100 } },
    },
  }),
});
// ...

Use all recommended plugins except polyfill.headless.

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

const browser = await chromium.launch({
  plugins: plugins.recommended({
    polyfill: {
      headless: false,
    },
  }),
});
// ...

Use all recommended plugins except humanize plugins (click, cursor and dialog).

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

const browser = await chromium.launch({
  plugins: plugins.recommended({
    humanize: false,
  }),
});
// ...

Advanced

Import

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

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

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