xcode-ui-testing - How to query labels in Xcode UI testing
问题描述
I see I can query textfields, tables, buttons, but not labels, why?
app.textFields["Username"].typeText("bcyops")
app.secureTextFields["Password"].typeText("ops15")
app.buttons["Submit"].tap()
app.tabBars.buttons["Main"].tap()
let tablesQuery = app.tables
解决方案
如果您的意思是将标签作为静态文本元素,您可以查询标签:
let label = app.staticTexts["yourLabelIdentifier"]
如果您需要标签中的文字
let textInLabel = app.staticTexts["yourLabelIdentifier"].label
所有元素类型的文档都在这里:https ://developer.apple.com/documentation/xctest/xcuielementtypequeryprovider
推荐阅读
- python - 使用流水线 hgetall 进行 Redis 慢速查询
- java - aws - java8 - 无法从 START_OBJECT 令牌中反序列化 java.lang.String 的实例
- reactjs - React - 完成表单提交后重定向
- sqlite - 使用来自 sqflite 的数据填充 FutureBuilder 时出错
- windows - 无法让公钥登录在 Windows 10 ssh 服务器上工作
- python - 从相应的 div 中获取所有 url
- crystal-reports-xi - Crystal Reports 在对整数和字符串求和时在做什么?
- javascript - 如何将 DOM 对象绑定到 JS 对象
- reactjs - 将钩子添加到引导菜单
- ansible - ansible查找挖掘:列表对象没有属性