在 iOS 上使用 Calabash 识别对象的最佳方法

Best way to identify objects using Calabash on iOS

我知道 calabash 附带了 irb 功能,允许您查询页面上的对象。然而,这似乎很麻烦。

Appium 附带了一个出色的开箱即用应用程序,可让您轻松识别页面上对象的详细信息。

有人知道可以与 Calabash 一起使用的等效工具吗?

您可以使用Ruby 来拉取所有元素。我假设您正在使用 mac,这是您需要逐步执行的操作:

  1. gem 安装葫芦-android
  2. 创建一个文件夹并将您的 apk 放入其中。
  3. 转到你的文件夹,calabash-android gen
  4. 葫芦-android辞职appName.apk
  5. 葫芦-android 构建 appName.apk
  6. 葫芦-android 运行 appName.apk
  7. 葫芦-android 控制台appname.apk
  8. query("Webview css='button') - 这将 return 你所有的按钮。你可以根据你的要求修改它。

更新

Calabash 0.19.0 添加了几个控制台方法来帮助发现应用程序视图层次结构中的元素。

   ids => List all the visible accessibility ids.
labels => List all the visible accessibility labels.
  text => List all the visible texts.
 marks => List all the visible marks.
  tree => The app's visible view hierarchy.
 flash => flash(<query>); Disco effect for views matching <query>

Reveal 是不错的选择。

Calabash 2.0 有 tree console command 可以移植到 Calabash iOS 0.x.

briar/irbrc

也有这些有用的方法