2016-03-14 32 views
2

所以在XCUITest我用這個代碼來獲得一個按鈕:XCUITest檢測的UIView

XCUIApplication *app = [[XCUIApplication alloc] init]; 
XCUIElement *button = app.buttons[@"button_identifier"]; 

獲得使用app.images等使用app.tables和形象的tableview。

但是我怎樣才能得到一個視圖(UIView)?

回答

2

目標C

XCUIApplication *app = [[XCUIApplication alloc] init]; 
XCUIElement *custom_view = app.otherElements[@"view_identifier"]; 

夫特

let app = XCUIApplication() 
let custom_view = app.OtherElements["view_identifier"]