Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.71 KB

File metadata and controls

66 lines (48 loc) · 1.71 KB

humanize.click

Tip

This plugin is enabled in the ⭐️ recommended.

Add delay between mousedown and mouseup for Locator.click(), Locator.dblclick(), Mouse.click() and Mouse.dblclick(). Deprecated methods (ex: Page.click()) class are not modified.

If you set the delay property when you call the method, your value will be used.

Options

This plugin supports the following options:

  • delay:
    • min (default 100): Minimum delay in milliseconds.
    • max (default 500): Maximum delay in milliseconds.

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.humanize.click()],
});
// ...

Use the plugin and specify the delay between 50 and 200 milliseconds.

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

const browser = await chromium.launch({
  plugins: [plugins.humanize.click({ delay: { min: 50, max: 200 } })],
});
// ...

Advanced

Import

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

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

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