automation

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

automation

Drive a running MyGo app from another process, as end-to-end test runners and agents do: list its windows, read the elements of their native UI with the app's keys, act on them, send pointer, wheel, key and text input, choose menu items, evaluate scripts in pages, capture windows, and wait for them to settle. One protocol on macOS, Linux and Windows: newline-delimited JSON over a Unix domain socket that only the user can open.

//go:build e2e

package main

import _ "github.com/egoist/mygo/plugins/automation"
MYGO_AUTOMATION=/tmp/app.sock ./app
echo '{"id": 1, "method": "windows"}' | socat - UNIX-CONNECT:/tmp/app.sock

It listens only when MYGO_AUTOMATION is set, and builds without the inspector (-tags mygo_noinspector, the release builds of mygo build) leave it out. See the documentation.

Documentation

Overview

Package automation lets another process drive a running app, as an end-to-end test runner or an agent does: list its windows, read what their native UI shows as elements, act on them, send pointer, wheel, key and text input, choose items of the application menu, evaluate scripts in pages, capture windows as PNG images, and wait for them to settle.

An app opts in by importing the package, as a file built for tests does:

//go:build e2e

package main

import _ "github.com/egoist/mygo/plugins/automation"

Then it listens only when the environment variable MYGO_AUTOMATION names the path of a Unix domain socket, which only the user can open, and answers JSON requests on it, one per line:

MYGO_AUTOMATION=/tmp/app.sock ./app

Builds without the inspector of native UI (-tags mygo_noinspector, as mygo build makes for release) leave the plugin out: it never listens there. See docs/plugins/automation.md for the protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error is a request's failure, with a code clients test and a message people read.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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