Aleh Sarochych Aleh Sarochych - 7 months ago 67
iOS Question

xCode 7, UI-Testing: working with UITableView

I'm facing with one problem using

framework for the xCode that Apple has introduced at WWDC 2015.
I have a UITableView and this table contains a lot of cells. Also I have a NSArray with cells titles - if cell title is contained in NSArray this cell should be tapped.
My problem is that I can't scroll table view for particular cell, because framework doesn't contain method for working with table views, only swipe gestures (down, up).

Maybe somebody knows how I can tap on particular cell in table view? Or how I can scroll table view for particular cell?
Because when I call
method for cell which are not visible at screen - nothing happen.

Thanks in advance!


This worked for me:

XCUIElementQuery *tablesQuery =;

XCUIElementQuery *cellQuery = [tablesQuery.cells containingType:XCUIElementTypeStaticText

XCUIElementQuery* cell = [cellQuery childrenMatchingType:XCUIElementTypeStaticText];

XCUIElement* cellElement = cell.element;

[cellElement tap];

For scrolling the table use:

XCUIElementQuery *tablesQuery =;
XCUIElement* table = tablesQuery.element;
[table swipeUp];