GREYAction

@protocol GREYAction <NSObject>

A protocol for actions that are performed on accessibility elements.

  • Perform the action specified by the GREYAction object on an @c element if and only if the @c element matches the constraints of the action.

    Declaration

    Objective-C

    - (BOOL)perform:(id)element error:(NSError **)errorOrNil;

    Swift

    func perform(_ element: Any!, error errorOrNil: UnsafeMutablePointer

    Parameters

    element

    The element the action is to be performed on. This must not be @c nil. @param[out] errorOrNil Error that will be populated on failure. The implementing class should handle the behavior when it is @c nil by, for example, logging the error or throwing an exception.

    errorOrNil

    Return Value

    @c YES if the action succeeded, else @c NO. If an action returns @c NO, it does not mean that the action was not performed at all but somewhere during the action execution the error occured and so the UI may be in an unrecoverable state.

  • A method to get the name of this action.

    Declaration

    Objective-C

    - (NSString *)name;

    Swift

    func name() -> String!

    Return Value

    The name of the action. If the action fails, then the name is printed along with all other relevant information.