Search code examples
androidcalabashcalabash-android

Calabash scroll down and select an item from the list when it is found


I am running calabash test for an android app. Selecting the country from the list of countries is not working for me. I have tried this but it was not working for me. When I query the list item the response is ,

{  
"id"=>"lab_country_name",
"enabled"=>true,
"contentDescription"=>nil,
"text"=>"Argentina",
"visible"=>true,
"tag"=>nil,
"description"=>"android.support.v7.widget.AppCompatTextView{  
 42201818   V.ED.... ........ 24,
    0-180,
    84   #7f0f00be app:id/lab_country_name
 }", "class"=>"android.support.v7.widget.AppCompatTextView",
"rect"=>{  
"center_y"   =>916,
"center_x"   =>102,
"height"   =>84,
"y"   =>874,
"width"   =>156,
"x"   =>24
  }

The id is common to every object in the list so I can't access it with the id and name. And it is possible to select the first element of the list using the id and not possible for the other items. When ever the scroll works the selection is not working and vice versa.


Solution

  • If you have control over the source control, you can change the id.

    Can you not select by text?

    query("* marked:'Argentina'")