docs(api.md): add example for Mouse class (#3244)

Fixes #3221.
This commit is contained in:
Andrey Lushnikov 2018-09-14 19:48:47 +01:00 committed by GitHub
parent d547b9d24a
commit f5d388af7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2035,6 +2035,19 @@ Dispatches a `keyup` event.
The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
Every `page` object has it's own Mouse, accessible with [`page.mouse`](#pagemouse).
```js
// Using page.mouse to trace a 100x100 square.
await page.mouse.move(0, 0);
await page.mouse.down();
await page.mouse.move(0, 100);
await page.mouse.move(100, 100);
await page.mouse.move(100, 0);
await page.mouse.move(0, 0);
await page.mouse.up();
```
#### mouse.click(x, y, [options])
- `x` <[number]>
- `y` <[number]>