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()];

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容