While loop condition not reevaluating

My video player selects and plays a given cell.
My goal is to wait until another video is played to proceed in the code.

while app.tables.elementBoundByIndex(0).cells.elementBoundByIndex(0).selected {}

Somehow, in the while loop, the reevaluation does not happen (when the cell is not selected anymore: cell.selected -> true), but when placing a breakpoint and checking manually in debugger, then cell.selected -> false

Running checks on the view hierarchy in a while loop does not cause the view hierarchy to be updated between each loop. The check will be made against a cached version of the view hierarchy, which will not be updated unless you interact with the app.