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();