Object representing an Accessibility element. You should not instantiate this directly, but rather, use the hs.ax methods to create these as required.

Properties

role

string

The element's role (e.g., "AXWindow", "AXButton")

subrole

string

The element's subrole

elementDescription

string

The element's description

isEnabled

boolean

Whether the element is enabled

isFocused

boolean

Whether the element is focused

position

HSPoint

The element's position on screen

frame

HSRect

The element's frame (position and size combined)

parent

HSAXElement

The element's parent

pid

number

Get the process ID of the application that owns this element

Methods

children()

The element's children

Parameters

None

Returns

HSAXElement[] - An array of HSAXElement objects

childAtIndex(index)

Get a specific child by index

Parameters

  • index number

    The index to fetch

Returns

HSAXElement - An HSAXElement object, if a child exists at the given index

attributeNames()

Get all available attribute names

Parameters

None

Returns

string[] - An array of attribute names

attributeValue(attribute)

Get the value of a specific attribute

Parameters

  • attribute string

    The attribute name to fetch the value for

Returns

any - The requested value, or nil if none was found

setAttributeValue(attribute, value)

Set the value of a specific attribute

Parameters

  • attribute string

    The attribute name to set

  • value any

    The value to set

Returns

boolean - True if the operation succeeded, otherwise False

isAttributeSettable(attribute)

Check if an attribute is settable

Parameters

  • attribute string

    An attribute name

Returns

boolean - True if the attribute is settable, otherwise False

actionNames()

Get all available action names

Parameters

None

Returns

string[] - An array of available action names

performAction(action)

Perform a specific action

Parameters

  • action string

    The action to perform

Returns

boolean - True if the action succeeded, otherwise False