Search code examples
javascriptiosinstrumentsios-ui-automation

UIAutomation, UITableView inside UITableViewCell


I have a horribly coded set of controllers which I am unable to refactor at this time. I need to bring them under automated testing, but have run into an issue with the UIAutomation tool.

These controllers are dynamically generated. There were many ways to do this but somebody decided it would be best if they made a tableview containing cells which each contain more tableviews, containing the cells that the user will see and interact with.

A simple example of one of these controllers is as follows:

enter image description here

I need to press one of those table view cells automagically.

After struggling with some view hierarchy issues, I finally managed to get the logElementTree to see all of the cells, with correct accessibility identifiers. Here is the result:

enter image description here

Now just to test that I can press one of the buttons from a script...

help

NOPE. I can't seem to drill down into the elements even though the logTree clearly shows they exist and are visible.

Any ideas very welcome. I'm not very experienced with javascript so I could be missing something obvious. Thanks!


Solution

  • To answer my own question and thanks to a helpful engineer at the WWDC:

    target.frontMostApp().mainWindow().tableViews()[0].cells()[0].tableViews()[0].cells()["Open"].tap();