ui 测试 xcode,如何使用 cellquery 点击表格视图单元格按钮 [英] ui testing xcode, how to tap on a table view cell button with cellquery

查看:20
本文介绍了ui 测试 xcode,如何使用 cellquery 点击表格视图单元格按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的应用程序进行 ui 测试,并且一直在单击我的应用程序的登录按钮.我无法找到我提供了标识符注册按钮的元素(该元素是索引的第三个元素,这不是问题).

I am currently doing ui tests for my app and stuck on clicking on the log in button of my app. I am unable to find the element which i have gave the identifier signup button(the element is the 3rd by index, this is not the issue).

let cellQuery = self.app.tables.cells.element(boundBy: 3)

let signInButton = cellQuery.buttons["signup button"]
if signInButton.exists {
    signInButton.tap()
}

推荐答案

如果按钮出现在第三个单元格中,那么它应该是:

If the button is present in the 3rd cell then it should be:

let cellQuery = self.app.tables.cells.element(boundBy: 2)
cellQuery.buttons["signup button"].tap()

如果按钮位于单元格中的第三个,则为单元格添加可访问性,然后:

If button is 3rd in the cell then add accessibility for the cells and then:

app.cells["AccessibilityIdentifier"].buttons.element(boundBy: 2).tap()

这篇关于ui 测试 xcode,如何使用 cellquery 点击表格视图单元格按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆