mouse

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package mouse injects mouse events via Chrome autotest private API.

Index

Constants

View Source
const (
	LeftButton    Button = "Left"
	RightButton          = "Right"
	MiddleButton         = "Middle"
	BackButton           = "Back"
	ForwardButton        = "Forward"
)

As defined in Button in https://cs.chromium.org/chromium/src/chrome/common/extensions/api/autotest_private.idl?l=90

Variables

This section is empty.

Functions

func Click

func Click(tconn *chrome.TestConn, location coords.Point, button Button) func(ctx context.Context) error

Click returns an func which causes a mouse click event. The location is relative to the top-left of the display.

func DoubleClick

func DoubleClick(tconn *chrome.TestConn, location coords.Point, doubleClickInterval time.Duration) func(ctx context.Context) error

DoubleClick returns an func which causes 2 mouse click events with an given interval. The location is relative to the top-left of the display.

func Drag

func Drag(tconn *chrome.TestConn, start, end coords.Point, duration time.Duration) func(ctx context.Context) error

Drag returns an func which is a helper function to cause a drag of the left button from start to end. The duration is the time between the movements from the start to the end (i.e. the duration of the drag), and the movement to the start happens instantly.

func Move

func Move(tconn *chrome.TestConn, location coords.Point, duration time.Duration) func(ctx context.Context) error

Move returns an func which requests to move the mouse cursor to a certain location. The location is relative to the top-left of the display. It does not support to move across multiple displays. When duration is 0, it moves instantly to the specified location. Otherwise, the cursor should move linearly during the period. Returns after the move event is handled by Ash. Note: If you want to move to a node, please use MouseMoveTo function defined in uiauto/automation.go.

func Press

func Press(tconn *chrome.TestConn, button Button) func(ctx context.Context) error

Press returns an func which requests a mouse press event on the current location of the mouse cursor. Ash will consider the button stays pressed, until release is requested.

func Release

func Release(tconn *chrome.TestConn, button Button) func(ctx context.Context) error

Release returns an func which requests a release event of a mouse button. It will do nothing when the button is not pressed.

Types

type Button

type Button string

Button specifies a button on mouse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL