带着androidviewclient麻烦的一堆照片

时间:2013-12-21 12:00:42

标签: android testing androidviewclient

有一个问题,我需要自动制作一张照片到我的Android应用程序,但没有id按钮“拿一个snaphsot”

仅在拍摄照片的屏幕上的

dump.py显示:

C:\Users\Dmitry.Markovnikov>dump.py
android.widget.FrameLayout id/no_id/1
   android.widget.LinearLayout id/no_id/2
      android.widget.FrameLayout id/no_id/3
         android.widget.RelativeLayout id/no_id/4
            android.widget.LinearLayout id/no_id/5
               android.view.View id/no_id/6
            android.widget.LinearLayout id/no_id/7
               android.view.View id/no_id/8
            android.widget.RelativeLayout id/no_id/9

那么我该如何拍摄一堆照片呢?谢谢!

更新

我使用了dump.py -d以及我在galaxy s 2上收到的内容(android ver,4.1.2):

C:\Users\Dmitry.Markovnikov>dump.py -d
android.widget.FrameLayout id/no_id/1  NAF
   android.widget.LinearLayout id/no_id/2  NAF
      android.widget.FrameLayout id/no_id/3  NAF
         android.widget.RelativeLayout id/no_id/4  NAF
            android.widget.LinearLayout id/no_id/5  NAF
               android.view.View id/no_id/6  NAF
            android.widget.LinearLayout id/no_id/7  NAF
               android.view.View id/no_id/8  NAF
            android.widget.RelativeLayout id/no_id/9  NAF

=(

1 个答案:

答案 0 :(得分:0)

如果您使用

$ dump -d

内容说明也将被转储,您将获得类似的内容

android.widget.FrameLayout id/no_id/1  NAF
   android.view.View id/no_id/2  NAF
      android.widget.FrameLayout id/no_id/3  NAF
         android.widget.FrameLayout id/no_id/4  NAF
            android.widget.FrameLayout id/no_id/5  NAF
               android.widget.RelativeLayout id/no_id/6  NAF
            android.view.View id/no_id/7  NAF
               android.widget.FrameLayout id/no_id/8  NAF
                  android.widget.FrameLayout id/no_id/9  NAF
                     android.view.View id/no_id/10  NAF
                  android.view.View id/no_id/11  NAF
                  android.widget.FrameLayout id/no_id/12  NAF
                     android.view.View id/no_id/13  NAF
                  android.widget.FrameLayout id/no_id/14  NAF
                     android.view.View id/no_id/15  NAF
                     android.widget.ImageView id/no_id/16  Camera, video, or panorama selector
                     android.widget.ImageView id/no_id/17  Shutter
        ...

然后,在您的脚本中,您可以执行类似

的操作
shutter = vc.findViewWithContentDescriptionOrRaise('''Shutter''')
shutter.touch()