Aleh Sarochych Aleh Sarochych - 1 year ago 109
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!

Answer Source

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];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download