Version: 1.11.0

Mouse

The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.

Every page object has its own Mouse, accessible with Page.mouse().

// Using ‘page.mouse’ to trace a 100x100 square.
page.mouse().move(0, 0);
page.mouse().down();
page.mouse().move(0, 100);
page.mouse().move(100, 100);
page.mouse().move(100, 0);
page.mouse().move(0, 0);
page.mouse().up();

Mouse.click(x, y[, options])#

  • x <double>
  • y <double>
  • options <Mouse.ClickOptions>
    • setButton <enum MouseButton { LEFT, RIGHT, MIDDLE }> Defaults to left.
    • setClickCount <int> defaults to 1. See UIEvent.detail.
    • setDelay <double> Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.
  • returns: <void>

Shortcut for Mouse.move(x, y[, options]), Mouse.down([options]), Mouse.up([options]).

Mouse.dblclick(x, y[, options])#

  • x <double>
  • y <double>
  • options <Mouse.DblclickOptions>
    • setButton <enum MouseButton { LEFT, RIGHT, MIDDLE }> Defaults to left.
    • setDelay <double> Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.
  • returns: <void>

Shortcut for Mouse.move(x, y[, options]), Mouse.down([options]), Mouse.up([options]), Mouse.down([options]) and Mouse.up([options]).

Mouse.down([options])#

  • options <Mouse.DownOptions>
    • setButton <enum MouseButton { LEFT, RIGHT, MIDDLE }> Defaults to left.
    • setClickCount <int> defaults to 1. See UIEvent.detail.
  • returns: <void>

Dispatches a mousedown event.

Mouse.move(x, y[, options])#

  • x <double>
  • y <double>
  • options <Mouse.MoveOptions>
    • setSteps <int> defaults to 1. Sends intermediate mousemove events.
  • returns: <void>

Dispatches a mousemove event.

Mouse.up([options])#

  • options <Mouse.UpOptions>
    • setButton <enum MouseButton { LEFT, RIGHT, MIDDLE }> Defaults to left.
    • setClickCount <int> defaults to 1. See UIEvent.detail.
  • returns: <void>

Dispatches a mouseup event.