Our app uses tabs (android.widget.TabWidget).

It looks similar to


Using Calabash, how to verify that 'TAB1' is selected in example?


Try this:

query "TabView {:isSelected == true}"

Or to get only caption of active tab:

query("TabView {:isSelected == true}", "text").first

Another possible solution:

query("tabWidget", :context, :tabHost, :currentTab)

And another one. This should work for you:

query "TabItemView {isSelected == true} TextView"

or text only: query "TabItemView {isSelected == true} TextView", :text

  • Sorry. Seem the query still not get the selected tab. Is there different solution? – Cuong Nguyen Jun 16 '14 at 2:41
  • I've updated an answer. – Dmitry Cheremushkin Jun 16 '14 at 5:58
  • Sorry for disturbing you one more time. When I query with query("tabWidget", :currentTab) I got the error "No accessor for currentTab". Is this because the developer? dropbox.com/s/9epapxvl82lgaqv/… – Cuong Nguyen Jun 16 '14 at 8:43
  • Added one more solution. This should work for your app: query "TabItemView {isSelected == true} TextView" – Dmitry Cheremushkin Jun 16 '14 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.