aezakmi-cursor
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

Aezakmi Cursor

Generate realistic, human-like mouse movement data between coordinates or navigate between elements with puppeteer like the definitely-not-robot you are.

Installation

yarn add aezakmi-cursor

or with npm

npm install aezakmi-cursor

Usage

Generating movement data between 2 coordinates.

import { path } from "aezakmi-cursor"

const from = { x: 100, y: 100 }
const to = { x: 600, y: 700 }

const route = path(from, to)

/**
 * [
 *   { x: 100, y: 100 },
 *   { x: 108.75573501957051, y: 102.83608396351725 },
 *   { x: 117.54686481838543, y: 106.20019239793275 },
 *   { x: 126.3749821408895, y: 110.08364505509256 },
 *   { x: 135.24167973152743, y: 114.47776168684264 }
 *   ... and so on
 * ]
 */

Usage with puppeteer:

import { createCursor } from "aezakmi-cursor"
import puppeteer from "puppeteer"

const run = async (url) => {
  const selector = "#sign-up button"
  const browser = await puppeteer.launch({ headless: false });
  const page = browser.newPage()
  const cursor = createCursor(page)
  await page.goto(url)
  await page.waitForSelector(selector)
  await cursor.click(selector)
  // shorthand for
  // await cursor.move(selector)
  // await cursor.click()
}

Readme

Keywords

Package Sidebar

Install

npm i aezakmi-cursor

Weekly Downloads

1

Version

1.2.3

License

ISC

Unpacked Size

39.6 kB

Total Files

8

Last publish

Collaborators

  • cyber_m8ng8l