Search code examples
androidautomationandroidviewclient

I see veiw ids but can't use them


While using latest 5.4.4 AndroidViewClient and 4.4.2 KitKat Android device I see desirable view ids with dump-simple.py provided file but when I try to use these ids with findViewByIdOrRaise method I receive an exception:

com.dtmilano.android.viewclient.ViewNotFoundException: Couldn't find View with ID='android.widget.ImageView fourier.milab:id/infoIcon' in tree with root=ROOT

I tried several times, no typos etc. So how can I use (touch etc.) these views?


Solution

  • Let culebra generate the script template for you

    $ culebra -VC -d on -o /tmp/kitkat.py
    

    the edit generated /tmp/kitkat.py script to suit your needs, for example if you want to touch the QSB bar, after the line with the findViewByIdOrRaise() add the touch()

    # class=android.widget.RelativeLayout
    com_android_launcher___id_qsb_search_bar = vc.findViewByIdOrRaise("com.android.launcher:id/qsb_search_bar")
    com_android_launcher___id_qsb_search_bar.touch()