UI Automation
4個(gè)新的classes:XCUIApplication,XCUIElement,XCUIElementQuery,XCUIDevice
(1)XCUIApplication:啟動(dòng)app,并為每個(gè)測(cè)試用例提供一個(gè)干凈的狀態(tài);
啟動(dòng)app,開始testing;如果調(diào)用改方法之前,app已經(jīng)處理運(yùn)行狀態(tài),該方法會(huì)先調(diào)用-(void)terminate方法以確保干凈的工作環(huán)境; -(void)launch;
停止app中所有正在運(yùn)行的工作; -(void)terminate;
(2)XCUIElement:頁面控件元素
//是否存在 @property (readonly) BOOL exists; //是否可點(diǎn)擊 @property (readonly, getter = isHittable) BOOL hittable; //通過控件的類型,返回該類控件查詢組 -(XCUIElementQuery *)descendantsMatchingType:(XCUIElementType) type; //通過控件的類型,返回改類控件的所有子控件; -(XCUIElementQuery*)childrenMatchingType:(XCUIElementType) type;
(3)XCUIElementQuery:元素查詢結(jié)果,提供符合條件的元素
//查詢結(jié)果中唯一的元素 @property (readonly) XCUIElement *element; //查詢結(jié)果中符合匹配的元素個(gè)數(shù) @property (readonly) NSUInteger count; //返回查詢結(jié)果中不是通過accessibility而是通過位置來定位的元素 - (XCUIElement *)elementBoundByIndex:(NSUInteger)index;
(4)XCUIDevice:物理設(shè)備
//設(shè)備顯示方向 @property (nonatomic) UIDeviceOrientation orientation; //物理按鍵,音量/home建 - (void)pressButton:(XCUIDeviceButton)button;
總結(jié)
以上是生活随笔為你收集整理的UI Automation的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿里云迁云方式大汇总
- 下一篇: 冒泡排序的多种写法、逻辑