3.1 Interaction APIs

1 Selecting an element to interact with,

2 Performing an action on it, and/or

3 Making an assertion to verify state and behavior.

EarlGrey Matchers:

grey_accessibilityID() / grey_accessibilityTrait() / grey_accessibilityLabel()

grey_sufficientlyVisible()

grey_allOf(), grey_anyOf(), grey_not()                    


Custom Matchers

To create custom matchers, use the block-based GREYElementMatcherBlock class.

Selecting Off-Screen UI Elements

In certain situations the UI element may be hidden off-screen, and may require certain interactions to bring it onto the screen.use the [usingSearchAction:onElementWithMatcher:] method to provide a search action for such elements[[[EarlGrey selectElementWithMatcher:aButtonMatcher]

    usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 50)

onElementWithMatcher:aScrollViewMatcher]

    performAction:grey_tap()];


[[[EarlGrey selectElementWithMatcher:aCellMatcher]

    usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, 50)

onElementWithMatcher:aTableViewMatcher]

    performAction:grey_tap()];

你可能感兴趣的:(3.1 Interaction APIs)