问题
What is the difference between
app.delay(20);
tableViewCell.waitForInvalid();
and
app.pushTimeout(20);
tableViewCell.waitForInvalid();
UIATarget.localTarget().popTimeout();
In the second case, in case if the cell becomes invalid in say 2secs, then will it still wait for 18secs and then continue or just continue after 2secs ? In the first case, it is waiting until 20secs.
回答1:
No, the second case is preferred because it will wait up to 20 seconds for the cell to become invalid. The first case, the script will delay for 20 seconds regardless. Pushing a new timeout changes the system wide timeout when waiting for elements to change on the screen. Pushing and popping as your scripts needs change is a very effective way to manage the different amounts of time you might need to wait for the script to verify the behavior you want.
来源:https://stackoverflow.com/questions/17835368/difference-between-delay-and-pushtimeout-poptimeout-in-uiautomation-ios