HSAXElement
Type
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")
elementDescription
string
The element's description
frame
HSRect
The element's frame (position and size combined)
pid
number
Get the process ID of the application that owns this element
Methods
children()
The element's children
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:55
Parameters
None
Returns
HSAXElement[] - An array of HSAXElement objects
childAtIndex(index)
Get a specific child by index
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:60
Parameters
-
indexnumberThe index to fetch
Returns
HSAXElement - An HSAXElement object, if a child exists at the given index
attributeNames()
Get all available attribute names
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:66
Parameters
None
Returns
string[] - An array of attribute names
attributeValue(attribute)
Get the value of a specific attribute
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:71
Parameters
-
attributestringThe 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
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:78
Parameters
-
attributestringThe attribute name to set
-
valueanyThe value to set
Returns
boolean - True if the operation succeeded, otherwise False
isAttributeSettable(attribute)
Check if an attribute is settable
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:83
Parameters
-
attributestringAn attribute name
Returns
boolean - True if the attribute is settable, otherwise False
actionNames()
Get all available action names
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:89
Parameters
None
Returns
string[] - An array of available action names
performAction(action)
Perform a specific action
Hammerspoon 2/Modules/hs.ax/HSAXElement.swift:94
Parameters
-
actionstringThe action to perform
Returns
boolean - True if the action succeeded, otherwise False