AXUIElementPerformAction(_:_:)
Requests that the specified accessibility object perform the specified action.
Declaration
func AXUIElementPerformAction(_ element: AXUIElement, _ action: CFString) -> AXErrorParameters
- element:
The AXUIElementRef representing the accessibility object.
- action:
The action to be performed.
Return Value
If unsuccessful, AXUIElementPerformAction may return one of the following error codes, among others:
kAXErrorActionUnsupportedThe specified AXUIElementRef does not support the specified action (you will also receive this error if you pass in the system-wide accessibility object).
kAXErrorIllegalArgumentOne or more of the arguments is an illegal value.
kAXErrorInvalidUIElementThe AXUIElementRef is invalid.
kAXErrorCannotCompleteThe function cannot complete because messaging has failed in some way or the application has not yet responded.
kAXErrorNotImplementedThe process does not fully support the accessibility API.
Discussion
It is possible to receive the kAXErrorCannotComplete error code from this function because accessible applications often need to perform some sort of modal processing inside their action callbacks and they may not return within the timeout value set by the accessibility API. This does not necessarily mean that the function has failed, however. If appropriate, your assistive application can try to call this function again. Also, you may be able to increase the timeout value (see AXUIElementSetMessagingTimeout(_:_:)).
See Also
Miscellaneous
AXIsProcessTrusted()AXIsProcessTrustedWithOptions(_:)AXUIElementCopyActionDescription(_:_:_:)AXUIElementCopyActionNames(_:_:)AXUIElementCopyAttributeNames(_:_:)AXUIElementCopyAttributeValue(_:_:_:)AXUIElementCopyAttributeValues(_:_:_:_:_:)AXUIElementCopyElementAtPosition(_:_:_:_:)AXUIElementCopyMultipleAttributeValues(_:_:_:_:)AXUIElementCopyParameterizedAttributeNames(_:_:)AXUIElementCopyParameterizedAttributeValue(_:_:_:_:)AXUIElementCreateApplication(_:)AXUIElementCreateSystemWide()AXUIElementGetAttributeValueCount(_:_:_:)AXUIElementGetPid(_:_:)AXUIElementGetTypeID()AXUIElementIsAttributeSettable(_:_:_:)AXUIElementSetAttributeValue(_:_:_:)AXUIElementSetMessagingTimeout(_:_:)