UIAutomation是隨iOS4.0系統一塊兒發佈的一款旨在iPhone Device/Simulator上可執行的自動化測試框架。app
附上一個顯示遍歷UI元素樹的腳本,保存爲本地的showUIAElementTree.js框架
DEMO_DELAY=2; var target = UIATarget.localTarget(); var app = target.frontMostApp(); //test functions function showCurrentViewInfo(){ UIALogger.logStart("show CurrentViewInfoTree"); try{ //show the target logElementTree target.logElementTree(); UIALogger.logPass(); } catch(error){ UIALogger.logFail(error); } } //calling test functions showCurrentViewInfo();