ios - 葫芦iOS如何点击后退按钮项目

标签 ios calabash calabash-ios

伙计们只是不知道如何使用 Calabash 框架从导航栏中点击 BackButtonItem,我正在这样设置 accessibilityLabel:

self.navigationItem.leftBarButtonItem?.accessibilityLabel = "goBack"

并试图像这样测试它但没有运气:

touch("* marked:'goBack'")
touch_transition('navigationItemButtonView first',
                       "* marked:'#{goBack}'")

最佳答案

问题在于 UINavigationItem、UITabBarItem 和 UIToobarItem 在运行时被转换为 View 。例如,一个 UITabBarItem 被转换为一个 UIToobarButton。在转换中,不保留 accessibilityIdentifier 和 accessibilityLabel 。

# This will probably get you the left navbar button
query("UINavigationItemButtonView index:0")

有一些方法可以强制保留 accessibilityIdentifier,例如从自定义 View 制作导航项。

看看 briar bars/navbar.rb寻找灵感。我不建议在你的项目中使用 briar;它的生命是不确定的(我是维护者)。

关于ios - 葫芦iOS如何点击后退按钮项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35559013/

相关文章:

ios - 在运行 CI 测试之前,如何强制关闭 iOS 升级对话框(和其他 Apple 对话框)?

ios - 如果为空则删除目录

ios - 通过对象将数据从父 ViewController 传递到子 UITableViewController

ios - 在嵌入式 YT IFrame 上禁用 iOS 弹性滚动

ios - Xcode 构建和运行错误 : "Process launch failed: Failed to get the task for process 216"

ios - calabash-ios UIPickerView 滚动到特定值

ruby - 为什么 xamarin 停止支持葫芦

ios - Calabash-iOS 没有启动服务器

android - 如何加快calabash-android的查询速度

ios - 在设备上运行 Cucumber,应用立即崩溃,错误 : "Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError"