Skip to content

Latest commit

 

History

History
70 lines (52 loc) · 2.12 KB

File metadata and controls

70 lines (52 loc) · 2.12 KB

humanize.cursor

Tip

This plugin is enabled in the ⭐️ recommended.

Move the cursor with human-like movements.

The following methods have been modified to add human-like movements: Locator.check(), Locator.click(), Locator.dblclick(), Locator.hover(), Locator.setChecked(), Locator.uncheck(), Mouse.click(), Mouse.dblclick() and Mouse.move(). Deprecated methods (ex: Page.click()) are not modified.

Options

This plugin supports the following option:

  • start:
    • x (default to a random position): Start position x of cursor.
    • y (default to a random position): Start position y of cursor.

Examples

Use the plugin with default options: random position in viewport.

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

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

Use the plugin and specify a start position of cursor.

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

const browser = await chromium.launch({
  plugins: [plugins.humanize.cursor({ start: { x: 100, y: 100 } })],
});
// ...

Advanced

Import

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

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

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