How to know which tab is currently selected on my Android app, using Calabash?



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

    It looks similar to

    example.

    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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2