Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Mouse

Index

Methods

Methods

click

  • click(x: number, y: number, options?: ClickOptions): Promise<void>
  • Shortcut for mouse.move, mouse.down and mouse.up.

    Parameters

    • x: number

      The x position.

    • y: number

      The y position.

    • Optional options: ClickOptions

      The click options.

    Returns Promise<void>

down

  • Dispatches a mousedown event.

    Parameters

    Returns Promise<void>

move

  • move(x: number, y: number, options?: { steps: number }): Promise<void>
  • Dispatches a mousemove event.

    Parameters

    • x: number

      The x position.

    • y: number

      The y position.

    • Optional options: { steps: number }

      The mouse move options.

      • steps: number

    Returns Promise<void>

up

  • Dispatches a mouseup event.

    Parameters

    Returns Promise<void>

wheel

  • Dispatches a mousewheel event.

    example

    An example of zooming into an element:

    await page.goto('https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366');
    
    const elem = await page.$('div');
    const boundingBox = await elem.boundingBox();
    await page.mouse.move(
      boundingBox.x + boundingBox.width / 2,
      boundingBox.y + boundingBox.height / 2
    );
    
    await page.mouse.wheel({ deltaY: -100 })
    

    Parameters

    Returns Promise<void>

Generated using TypeDoc