https://github.com/cenfun/mouse-helper
A tool to show mouse position and status for screenshots in automation test such as Puppeteer or Playwright
https://github.com/cenfun/mouse-helper
helper mouse playwright puppeteer screenshot
Last synced: 3 months ago
JSON representation
A tool to show mouse position and status for screenshots in automation test such as Puppeteer or Playwright
- Host: GitHub
- URL: https://github.com/cenfun/mouse-helper
- Owner: cenfun
- License: mit
- Created: 2020-01-10T12:13:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-27T02:47:31.000Z (about 2 years ago)
- Last Synced: 2025-04-19T12:08:03.771Z (3 months ago)
- Topics: helper, mouse, playwright, puppeteer, screenshot
- Language: JavaScript
- Homepage: https://cenfun.github.io/mouse-helper/
- Size: 67.4 KB
- Stars: 21
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mouse Helper
[](https://www.npmjs.com/package/mouse-helper)

[](https://www.npmjs.com/package/mouse-helper)
A tool to show mouse position and status for screenshots in automation test such as [Puppeteer](https://github.com/puppeteer/puppeteer) or [Playwright](https://github.com/microsoft/playwright)
## Install
```sh
npm i mouse-helper
```
## Preview Online
[https://cenfun.github.io/mouse-helper/](https://cenfun.github.io/mouse-helper/)## Preview Screenshots
screenshot mouse move(20, 50)
screenshot mouse down
screenshot mouse none (mouse never moved)
## Usage
```js
require("mouse-helper")();
```
## Browser Usage
```htmlwindow['mouse-helper']();
```
see [/public/index.html](/public/index.html)## Playwright Usage
```js
const { chromium } = require('playwright');const browser = await chromium.launch();
const context = await browser.newContext();
await context.addInitScript({
path: './node_modules/mouse-helper/dist/mouse-helper.js'
});const page = await context.newPage();
await page.goto("your page url");await page.evaluate(() => {
window['mouse-helper']();
});await page.mouse.move(20, 50);
await page.screenshot({
path: "your screenshot path"
});await page.mouse.down();
await page.screenshot({
path: "your screenshot path"
});await page.mouse.up();
```
see [/scripts/test.js](/scripts/test.js)