From f5d388af7dda492f3932f8c21e9f132e306565a3 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 14 Sep 2018 19:48:47 +0100 Subject: [PATCH] docs(api.md): add example for Mouse class (#3244) Fixes #3221. --- docs/api.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/api.md b/docs/api.md index 75ac0250..943bb12e 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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]>