axuiautomation

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package axuiautomation provides XCUIAutomation-style interfaces for macOS accessibility automation.

This package wraps the macOS Accessibility APIs (AXUIElement, AXObserver, etc.) with a clean, Go-idiomatic interface inspired by Apple's XCUIAutomation framework.

Core Types

  • Application: represents a running application
  • Element: represents a UI element (button, window, etc.)
  • ElementQuery: fluent API for finding elements
  • Observer: event-based waiting for UI state changes

Example Usage

app, err := axuiautomation.NewApplication("com.apple.dt.Xcode")
if err != nil {
    log.Fatal(err)
}
defer app.Close()

// Find and click a button
replayBtn := app.Windows().Buttons().ByTitle("Replay").Element(0)
if replayBtn.Exists() && replayBtn.IsEnabled() {
    replayBtn.Click()
}

// Wait for element with observer
observer, _ := app.NewObserver()
defer observer.Close()
err = observer.WaitForEnabled(replayBtn, 5*time.Minute)

Thread Safety

The macOS Accessibility API must be called from the main thread. Callers should use runtime.LockOSThread in their main goroutine before calling any functions in this package. Observer-based waiting methods spin the CFRunLoop internally, which also requires the main thread.

Memory Ownership

Elements returned from query methods (First, AllElements, Element) are caller-owned and must be released by calling Release when no longer needed. Application.Close releases the root element; callers must still release any elements obtained from queries. Failing to release elements leaks the underlying AXUIElementRef.

Accessibility Permissions

This package requires accessibility permissions. Use IsProcessTrusted() to check if your app has the required permissions.

Index

Examples

Constants

View Source
const (
	NotificationFocusedUIElementChanged = "AXFocusedUIElementChanged"
	NotificationValueChanged            = "AXValueChanged"
	NotificationUIElementDestroyed      = "AXUIElementDestroyed"
	NotificationWindowCreated           = "AXWindowCreated"
	NotificationWindowMoved             = "AXWindowMoved"
	NotificationWindowResized           = "AXWindowResized"
	NotificationWindowMiniaturized      = "AXWindowMiniaturized"
	NotificationWindowDeminiaturized    = "AXWindowDeminiaturized"
	NotificationApplicationActivated    = "AXApplicationActivated"
	NotificationApplicationDeactivated  = "AXApplicationDeactivated"
	NotificationApplicationHidden       = "AXApplicationHidden"
	NotificationApplicationShown        = "AXApplicationShown"
	NotificationSelectedChildrenChanged = "AXSelectedChildrenChanged"
	NotificationSelectedTextChanged     = "AXSelectedTextChanged"
	NotificationTitleChanged            = "AXTitleChanged"
)

Common AX notification names

Variables

View Source
var (
	ErrNotRunning        = errors.New("application not running")
	ErrElementNotFound   = errors.New("element not found")
	ErrTimeout           = errors.New("operation timed out")
	ErrAPIDisabled       = errors.New("accessibility API disabled")
	ErrActionUnsupported = errors.New("action not supported")
	ErrInvalidElement    = errors.New("invalid UI element")
)

Common errors

Functions

func AXIsProcessTrusted

func AXIsProcessTrusted() bool

func AXIsProcessTrustedWithOptions

func AXIsProcessTrustedWithOptions(options uintptr) bool

func AXObserverGetRunLoopSource

func AXObserverGetRunLoopSource(observer AXObserverRef) uintptr

func AXValueGetValue

func AXValueGetValue(value AXValueRef, valueType AXValueType, valuePtr unsafe.Pointer) bool

func CheckAccessibilityAccess

func CheckAccessibilityAccess(pid int32) (int, string)

CheckAccessibilityAccess performs a diagnostic check to see if accessibility API is working. Returns the AX error code (0 = success, -25211 = API disabled/no permission).

func CheckScreenCapture

func CheckScreenCapture()

func CheckTrust

func CheckTrust()

CheckTrust checks if the process has Accessibility permission and, if not, shows a floating window with a spinner and buttons to open System Settings or reset TCC. It polls until permission is granted, then briefly shows a green checkmark before closing.

func CheckTrustWithPrompt

func CheckTrustWithPrompt()

CheckTrustWithPrompt is like CheckTrust but also triggers the system universalAccessAuthWarn permission dialog. Prefer CheckTrust for a less disruptive experience.

func IsProcessTrusted

func IsProcessTrusted() bool

IsProcessTrusted checks if the current process has accessibility permissions.

func IsScreenRecordingTrusted

func IsScreenRecordingTrusted() bool

func PromptForAccessibility

func PromptForAccessibility() bool

PromptForAccessibility triggers the system accessibility permission prompt. Returns true if already trusted, false otherwise.

func SendArrowDown

func SendArrowDown() error

SendArrowDown sends a Down arrow key press.

func SendArrowLeft

func SendArrowLeft() error

SendArrowLeft sends a Left arrow key press.

func SendArrowRight

func SendArrowRight() error

SendArrowRight sends a Right arrow key press.

func SendArrowUp

func SendArrowUp() error

SendArrowUp sends an Up arrow key press.

func SendCmdN

func SendCmdN() error

SendCmdN sends Command+N (New file/item).

func SendCmdShiftG

func SendCmdShiftG() error

SendCmdShiftG sends Command+Shift+G (Go to Folder in save dialogs).

func SendDelete

func SendDelete() error

SendDelete sends a Delete (backspace) key press.

func SendEscape

func SendEscape() error

SendEscape sends an escape key press.

func SendKeyCombo

func SendKeyCombo(keyCode uint16, shift, control, option, command bool) error

SendKeyCombo sends a key combination with modifiers. Modifiers: shift, control, option, command

func SendReturn

func SendReturn() error

SendReturn sends a return key press.

func SendShiftTab

func SendShiftTab() error

SendShiftTab sends Shift+Tab.

func SendTab

func SendTab() error

SendTab sends a Tab key press.

func SpinMainRunLoop

func SpinMainRunLoop(d time.Duration)

SpinMainRunLoop briefly runs the NSRunLoop on the main thread for the given duration. Unlike SpinRunLoop (which only pumps CFRunLoop), this also drains the GCD main queue, so DispatchMainSafe callbacks and AppKit UI events are processed. Must be called from the main OS thread.

func SpinRunLoop

func SpinRunLoop(d time.Duration)

SpinRunLoop briefly spins the current thread's CFRunLoop to allow pending accessibility IPC replies to be delivered. Many AX attributes (notably AXMenuBar) require at least one run-loop iteration to return a value in processes that do not otherwise run a persistent run loop (e.g. CLI tools).

func TypeText

func TypeText(text string) error

TypeText types text into the currently focused element by sending keyboard events. It supports printable ASCII characters. Use Element.TypeText for element-targeted input.

Types

type AXError

type AXError = int32

func AXObserverAddNotification

func AXObserverAddNotification(observer AXObserverRef, element AXUIElementRef, notification uintptr, refcon unsafe.Pointer) AXError

func AXObserverCreate

func AXObserverCreate(pid int32, callback AXObserverCallback, observer *AXObserverRef) AXError

func AXUIElementCopyAttributeValue

func AXUIElementCopyAttributeValue(element AXUIElementRef, attribute uintptr, value *uintptr) AXError

func AXUIElementCopyAttributeValueCF

func AXUIElementCopyAttributeValueCF(element AXUIElementRef, attribute uintptr, value *unsafe.Pointer) AXError

AXUIElementCopyAttributeValueCF is a version that works with CFTypeRef pointers

func AXUIElementGetAttributeValueCount

func AXUIElementGetAttributeValueCount(element AXUIElementRef, attribute uintptr, count *int) AXError

func AXUIElementGetPid

func AXUIElementGetPid(element AXUIElementRef, pid *int32) AXError

func AXUIElementPerformAction

func AXUIElementPerformAction(element AXUIElementRef, action uintptr) AXError

func AXUIElementSetAttributeValue

func AXUIElementSetAttributeValue(element AXUIElementRef, attribute uintptr, value uintptr) AXError

type AXObserverCallback

type AXObserverCallback = uintptr

type AXObserverRef

type AXObserverRef = uintptr

type AXUIElementRef

type AXUIElementRef = uintptr

Type aliases for accessibility types

func AXUIElementCreateApplication

func AXUIElementCreateApplication(pid int32) AXUIElementRef

type AXValueRef

type AXValueRef = uintptr

func AXValueCreate

func AXValueCreate(valueType AXValueType, valuePtr unsafe.Pointer) AXValueRef

type AXValueType

type AXValueType = int32

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application represents a running macOS application for accessibility automation. It holds the root AXUIElementRef for the process and serves as the entry point for element queries and observers. Call Close when done to release the root element and cached resources.

func NewApplication

func NewApplication(bundleID string) (*Application, error)

NewApplication creates a new Application by bundle ID. It looks up the running process by bundle ID and creates an accessibility element for it.

Example

Example tests

package main

import (
	"github.com/tmc/apple/x/axuiautomation"
)

func main() {
	app, err := axuiautomation.NewApplication("com.apple.finder")
	if err != nil {
		return
	}
	defer app.Close()

	// Get the first window
	window := app.Windows().First()
	if window != nil {
		_ = window.Title()
	}
}

func NewApplicationFromPID

func NewApplicationFromPID(pid int32) *Application

NewApplicationFromPID creates a new Application from a process ID.

func (*Application) Activate

func (a *Application) Activate() error

Activate brings the application to the foreground.

func (*Application) BundleID

func (a *Application) BundleID() string

BundleID returns the application's bundle ID.

func (*Application) Buttons

func (a *Application) Buttons() *ElementQuery

Buttons returns a query for all buttons in the application.

func (*Application) Checkboxes

func (a *Application) Checkboxes() *ElementQuery

Checkboxes returns a query for all checkboxes in the application.

func (*Application) ClickMenuItem

func (a *Application) ClickMenuItem(path []string) error

ClickMenuItem clicks a menu item by its path (e.g., ["File", "Export..."]).

func (*Application) Close

func (a *Application) Close()

Close releases all resources associated with the application.

func (*Application) Descendants

func (a *Application) Descendants() *ElementQuery

Descendants returns a query for all descendants of the application root.

func (*Application) Dialogs

func (a *Application) Dialogs() *ElementQuery

Dialogs returns a query for all dialog windows.

func (*Application) FocusedElement

func (a *Application) FocusedElement() *Element

FocusedElement returns the currently focused element.

func (*Application) IsRunning

func (a *Application) IsRunning() bool

IsRunning returns true if the application is still running.

func (*Application) MainWindow

func (a *Application) MainWindow() *Element

MainWindow returns the application's main window (first window).

func (*Application) MenuBar

func (a *Application) MenuBar() *Element

MenuBar returns the application's menu bar element. It spins the CFRunLoop briefly on each attempt so that AX IPC replies are delivered even in CLI processes that do not run a persistent event loop.

func (*Application) NewObserver

func (a *Application) NewObserver() (*Observer, error)

NewObserver creates a new observer for this application.

func (*Application) PID

func (a *Application) PID() int32

PID returns the application's process ID.

func (*Application) Root

func (a *Application) Root() *Element

Root returns the root accessibility element for the application.

func (*Application) Sheets

func (a *Application) Sheets() *ElementQuery

Sheets returns a query for all sheet windows.

func (*Application) TextFields

func (a *Application) TextFields() *ElementQuery

TextFields returns a query for all text fields in the application.

func (*Application) WaitForWindow

func (a *Application) WaitForWindow(title string, timeout time.Duration) (*Element, error)

WaitForWindow waits up to timeout for a window whose title contains the given substring to appear.

func (*Application) WindowByTitle

func (a *Application) WindowByTitle(title string) *Element

WindowByTitle returns the first window with the given title.

func (*Application) WindowByTitleContains

func (a *Application) WindowByTitleContains(substr string) *Element

WindowByTitleContains returns the first window whose title contains the given substring.

func (*Application) WindowList

func (a *Application) WindowList() []*Element

WindowList returns all windows using the AXWindows attribute directly, which is faster and more reliable than traversing AXChildren.

func (*Application) Windows

func (a *Application) Windows() *ElementQuery

Windows returns a query for all windows of the application.

type Element

type Element struct {
	// contains filtered or unexported fields
}

Element wraps an AXUIElementRef with Go ownership semantics. Elements obtained from query methods (First, AllElements, Element) are caller-owned and must be released by calling Release. The zero value is not usable; use NewApplication or query methods to obtain elements.

func (*Element) Application

func (e *Element) Application() *Application

Application returns the parent Application for this element.

func (*Element) Buttons

func (e *Element) Buttons() *ElementQuery

Buttons returns a query for button elements.

func (*Element) Center

func (e *Element) Center() (x, y int)

Center returns the center point of the element.

func (*Element) Checkboxes

func (e *Element) Checkboxes() *ElementQuery

Checkboxes returns a query for checkbox elements.

func (*Element) ChildCount

func (e *Element) ChildCount() int

ChildCount returns the number of children.

func (*Element) Children

func (e *Element) Children() []*Element

Children returns the element's children.

func (*Element) Click

func (e *Element) Click() error

Click performs a click on the element. It first tries AXPress, then falls back to CGEvent if AXPress fails.

func (*Element) ClickAt

func (e *Element) ClickAt(xOffset, yOffset int) error

ClickAt performs a low-level CGEvent click at a specific offset relative to the element's top-left origin.

func (*Element) Descendants

func (e *Element) Descendants() *ElementQuery

Descendants returns a query for all descendants of this element.

func (*Element) Description

func (e *Element) Description() string

Description returns the element's description.

func (*Element) Document

func (e *Element) Document() string

Document returns the element's document URL (typically for windows).

func (*Element) DoubleClick

func (e *Element) DoubleClick() error

DoubleClick performs a double-click on the element.

func (*Element) Exists

func (e *Element) Exists() bool

Exists returns true if the element reference is valid.

func (*Element) Focus

func (e *Element) Focus() error

Focus sets focus to this element.

func (*Element) Frame

func (e *Element) Frame() Rect

Frame returns the element's frame (position + size).

func (*Element) Groups

func (e *Element) Groups() *ElementQuery

Groups returns a query for group elements.

func (*Element) Hover

func (e *Element) Hover() error

Hover moves the mouse cursor to the center of the element without clicking.

func (*Element) Identifier

func (e *Element) Identifier() string

Identifier returns the element's unique identifier.

func (*Element) IntValue

func (e *Element) IntValue() int

IntValue returns the element's value as an integer. Returns 0 if the value is not a number.

func (*Element) IsChecked

func (e *Element) IsChecked() bool

IsChecked returns true if the element's value is truthy (for checkboxes/switches).

func (*Element) IsEnabled

func (e *Element) IsEnabled() bool

IsEnabled returns true if the element is enabled/interactive.

func (*Element) IsFocused

func (e *Element) IsFocused() bool

IsFocused returns true if the element is focused.

func (*Element) IsSelected

func (e *Element) IsSelected() bool

IsSelected returns true if the element is selected.

func (*Element) MenuItems

func (e *Element) MenuItems() *ElementQuery

MenuItems returns a query for menu item elements.

func (*Element) Parent

func (e *Element) Parent() *Element

Parent returns the parent element.

func (*Element) PerformAction

func (e *Element) PerformAction(action string) error

PerformAction performs a named accessibility action on the element.

func (*Element) PopUpButtons

func (e *Element) PopUpButtons() *ElementQuery

PopUpButtons returns a query for popup button elements.

func (*Element) Position

func (e *Element) Position() (x, y int)

Position returns the element's position on screen.

func (*Element) Raise

func (e *Element) Raise() error

Raise raises the window to the front.

func (*Element) Ref

func (e *Element) Ref() AXUIElementRef

Ref returns the underlying AXUIElementRef. The caller should not release this ref; it is owned by the Element.

func (*Element) Release

func (e *Element) Release()

Release releases the underlying AXUIElementRef. Callers must call Release on elements returned from query methods (First, AllElements, Element, Parent, Children, FocusedElement, etc.) when the element is no longer needed. After calling Release, the Element must not be used.

func (*Element) Role

func (e *Element) Role() string

Role returns the element's accessibility role (e.g., "AXButton", "AXWindow").

func (*Element) RoleDescription

func (e *Element) RoleDescription() string

RoleDescription returns the element's localized role description.

func (*Element) Screenshot

func (e *Element) Screenshot() ([]byte, error)

Screenshot captures a PNG of the element's on-screen frame using screencapture. Returns an error if the element has no frame or the capture fails.

func (*Element) Scroll

func (e *Element) Scroll(direction ScrollDirection, lines int) error

Scroll scrolls the element in the given direction by the given number of lines. It first tries the AXScroll action, then falls back to CGEvent scroll wheel.

func (*Element) ScrollAndClick

func (e *Element) ScrollAndClick() error

ScrollAndClick scrolls the element into view and then clicks it.

func (*Element) ScrollToVisible

func (e *Element) ScrollToVisible() error

ScrollToVisible scrolls through ancestor scroll areas until this element is visible. It walks up the tree looking for an AXScrollArea or AXOutline parent and scrolls it.

func (*Element) SelectMenuItem

func (e *Element) SelectMenuItem(title string) error

SelectMenuItem clicks this element (assumed to be an AXPopUpButton or AXComboBox), waits for the menu to open, and clicks the menu item with the given title.

func (*Element) SelectValue

func (e *Element) SelectValue(value string) error

SelectValue sets the value of a combo box or other value-settable element, then tries to select a matching item from a popup if present.

func (*Element) SetPosition

func (e *Element) SetPosition(x, y float64) error

SetPosition moves the element to the specified coordinates.

func (*Element) SetValue

func (e *Element) SetValue(value string) error

SetValue sets the element's value.

func (*Element) Size

func (e *Element) Size() (width, height int)

Size returns the element's size.

func (*Element) StaticTexts

func (e *Element) StaticTexts() *ElementQuery

StaticTexts returns a query for static text elements.

func (*Element) Subrole

func (e *Element) Subrole() string

Subrole returns the element's accessibility subrole.

func (*Element) TextFields

func (e *Element) TextFields() *ElementQuery

TextFields returns a query for text field elements.

func (*Element) Title

func (e *Element) Title() string

Title returns the element's title.

func (*Element) TypeText

func (e *Element) TypeText(text string) error

TypeText focuses the element and types the given text using keyboard events.

func (*Element) Value

func (e *Element) Value() string

Value returns the element's value as a string.

func (*Element) WaitAndClick

func (e *Element) WaitAndClick(timeout time.Duration) error

WaitAndClick waits up to timeout for the element to exist and be enabled, then clicks it.

func (*Element) Windows

func (e *Element) Windows() *ElementQuery

Windows returns a query for window elements.

type ElementPredicate

type ElementPredicate func(*Element) bool

ElementPredicate is a function that tests if an element matches criteria.

type ElementQuery

type ElementQuery struct {
	// contains filtered or unexported fields
}

ElementQuery provides a fluent builder for finding UI elements by chaining predicates such as ByRole, ByTitle, and Matching. Each filter method returns a new query, leaving the original unmodified. Terminal methods (First, AllElements, Element) execute the search and return caller-owned elements that must be released.

Example
package main

import (
	"github.com/tmc/apple/x/axuiautomation"
)

func main() {
	app, err := axuiautomation.NewApplication("com.apple.finder")
	if err != nil {
		return
	}
	defer app.Close()

	// Find all buttons with "OK" in the title
	buttons := app.Buttons().ByTitleContains("OK").AllElements()
	for _, btn := range buttons {
		_ = btn.Title()
	}
}

func (*ElementQuery) AllElements

func (q *ElementQuery) AllElements() []*Element

AllElements returns all matching elements. The returned elements are caller-owned and each must be released.

func (*ElementQuery) ByDescription

func (q *ElementQuery) ByDescription(desc string) *ElementQuery

ByDescription filters elements by their description.

func (*ElementQuery) ByIdentifier

func (q *ElementQuery) ByIdentifier(id string) *ElementQuery

ByIdentifier filters elements by their unique identifier.

func (*ElementQuery) ByRole

func (q *ElementQuery) ByRole(role string) *ElementQuery

ByRole filters elements by their accessibility role.

func (*ElementQuery) ByTitle

func (q *ElementQuery) ByTitle(title string) *ElementQuery

ByTitle filters elements by their title.

func (*ElementQuery) ByTitleContains

func (q *ElementQuery) ByTitleContains(substr string) *ElementQuery

ByTitleContains filters elements whose title contains the given substring.

func (*ElementQuery) ByTitlePrefix

func (q *ElementQuery) ByTitlePrefix(prefix string) *ElementQuery

ByTitlePrefix filters elements whose title starts with the given prefix.

func (*ElementQuery) ByValue

func (q *ElementQuery) ByValue(value string) *ElementQuery

ByValue filters elements by their value.

func (*ElementQuery) Count

func (q *ElementQuery) Count() int

Count returns the number of matching elements.

func (*ElementQuery) Element

func (q *ElementQuery) Element(index int) *Element

Element returns the element at the given index (0 for first match).

func (*ElementQuery) Enabled

func (q *ElementQuery) Enabled() *ElementQuery

Enabled filters to only enabled elements.

func (*ElementQuery) Exists

func (q *ElementQuery) Exists() bool

Exists returns true if at least one matching element exists.

func (*ElementQuery) First

func (q *ElementQuery) First() *Element

First returns the first matching element, or nil if none match. The returned element is caller-owned and must be released.

func (*ElementQuery) Focused

func (q *ElementQuery) Focused() *ElementQuery

Focused filters to only focused elements.

func (*ElementQuery) ForEach

func (q *ElementQuery) ForEach(fn func(*Element) bool)

ForEach calls the given function for each matching element. The function can return false to stop iteration.

func (*ElementQuery) Matching

func (q *ElementQuery) Matching(pred ElementPredicate) *ElementQuery

Matching adds a custom predicate to the query.

func (*ElementQuery) Selected

func (q *ElementQuery) Selected() *ElementQuery

Selected filters to only selected elements.

func (*ElementQuery) WithLimit

func (q *ElementQuery) WithLimit(n int) *ElementQuery

WithLimit sets the maximum number of elements to visit during search.

func (*ElementQuery) WithTraversal

func (q *ElementQuery) WithTraversal(mode TraversalMode) *ElementQuery

WithTraversal sets the traversal mode (BFS or DFS).

type Error

type Error struct {
	Code    int
	Message string
}

Error wraps accessibility error codes

func (*Error) Error

func (e *Error) Error() string

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

Observer provides event-based waiting for UI state changes using the AXObserver API. Observer methods spin the CFRunLoop to receive notifications, which requires the caller to be on the main thread (see runtime.LockOSThread). Call Close to release all resources.

func NewObserver

func NewObserver(app *Application) (*Observer, error)

NewObserver creates a new observer for the given application.

func (*Observer) Close

func (o *Observer) Close()

Close releases all resources associated with the observer.

func (*Observer) OnFocusChanged

func (o *Observer) OnFocusChanged(handler ObserverHandler) error

OnFocusChanged registers a handler for focus change notifications.

func (*Observer) OnNotification

func (o *Observer) OnNotification(name string, element *Element, handler ObserverHandler) error

OnNotification registers a handler for a specific notification on an element.

func (*Observer) OnUIElementDestroyed

func (o *Observer) OnUIElementDestroyed(element *Element, handler ObserverHandler) error

OnUIElementDestroyed registers a handler for element destruction notifications.

func (*Observer) OnValueChanged

func (o *Observer) OnValueChanged(element *Element, handler ObserverHandler) error

OnValueChanged registers a handler for value change notifications.

func (*Observer) OnWindowCreated

func (o *Observer) OnWindowCreated(handler ObserverHandler) error

OnWindowCreated registers a handler for window creation notifications.

func (*Observer) Start

func (o *Observer) Start()

Start starts processing events. Call this after registering all handlers.

func (*Observer) Stop

func (o *Observer) Stop()

Stop stops processing events.

func (*Observer) WaitForDisappear

func (o *Observer) WaitForDisappear(element *Element, timeout time.Duration) error

WaitForDisappear waits for an element to disappear (no longer exists).

func (*Observer) WaitForElement

func (o *Observer) WaitForElement(query *ElementQuery, timeout time.Duration) (*Element, error)

WaitForElement waits for an element matching the query to appear.

func (*Observer) WaitForEnabled

func (o *Observer) WaitForEnabled(element *Element, timeout time.Duration) error

WaitForEnabled waits for an element to become enabled.

func (*Observer) WaitForValueChange

func (o *Observer) WaitForValueChange(element *Element, timeout time.Duration) error

WaitForValueChange waits for an element's value to change.

func (*Observer) WaitWithCondition

func (o *Observer) WaitWithCondition(condition func() bool, timeout time.Duration) error

WaitWithCondition waits for a custom condition to be true.

type ObserverEvent

type ObserverEvent struct {
	Element      *Element
	Notification string
}

ObserverEvent represents an accessibility notification event.

type ObserverHandler

type ObserverHandler func(event ObserverEvent)

ObserverHandler is a callback function for handling observer events.

type Point

type Point struct {
	X, Y float64
}

Point represents a point in 2D space

type Rect

type Rect struct {
	Origin Point
	Size   Size
}

Rect represents a rectangle in 2D space

type ScrollDirection

type ScrollDirection int

ScrollDirection specifies the direction to scroll.

const (
	ScrollUp ScrollDirection = iota
	ScrollDown
	ScrollLeft
	ScrollRight
)

type Size

type Size struct {
	Width, Height float64
}

Size represents a size in 2D space

type TraversalMode

type TraversalMode int

TraversalMode specifies how to traverse the element tree.

const (
	// BFS performs breadth-first search (default).
	BFS TraversalMode = iota
	// DFS performs depth-first search.
	DFS
)

Jump to

Keyboard shortcuts

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