我有一个带有两个开关的 tableViewCell。一个总是存在,另一个是隐藏的,只有在我将 UIPicker 设置为特定值时才会出现。
在我的测试用例中,我将 UIPicker 设置为必要的值,如下所示:
var app = XCUIApplication()
let tablesQuery = app.tables
tablesQuery.cells.childrenMatchingType(.TextField).elementBoundByIndex(1).tap()
app.pickerWheels["Value 1"].tap()
app.pickerWheels["Value 1"].adjustToPickerWheelValue("Value 2")
app.toolbars.buttons["Done"].tap()
查看模拟器,第二个开关根据需要出现。但是,它在app.switches
.
我试图重新加载 XCUIApplication :
app = XCUIApplication()
但是在调试器中,当我打印出 app.switches 时,第二个开关不存在。我在 Interface Builder 中为其设置了标识符,但仍然没有。以下不起作用:
let current401kToggle = app.switches.elementMatchingType(.Switch, identifier: "Value2Toggle")
任何帮助表示赞赏:) 谢谢!