Documentation
¶
Overview ¶
Package mouse injects mouse events via Chrome autotest private API.
Index ¶
- Constants
- func Click(tconn *chrome.TestConn, location coords.Point, button Button) func(ctx context.Context) error
- func DoubleClick(tconn *chrome.TestConn, location coords.Point, ...) func(ctx context.Context) error
- func Drag(tconn *chrome.TestConn, start, end coords.Point, duration time.Duration) func(ctx context.Context) error
- func Move(tconn *chrome.TestConn, location coords.Point, duration time.Duration) func(ctx context.Context) error
- func Press(tconn *chrome.TestConn, button Button) func(ctx context.Context) error
- func Release(tconn *chrome.TestConn, button Button) func(ctx context.Context) error
- type Button
Constants ¶
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.