这是我当前项目的联盟屏幕:
..这是使用monkeyrunner dump.py的视图读数:
android.widget.FrameLayout id/no_id/1
android.widget.LinearLayout id/no_id/2
android.widget.FrameLayout id/no_id/3
android.view.View id/no_id/4
android.widget.FrameLayout id/no_id/5
android.widget.ImageView id/no_id/6
android.widget.ImageView id/no_id/7
android.widget.LinearLayout id/no_id/8
android.widget.LinearLayout id/no_id/9
android.widget.TextView id/no_id/10 Alliances
android.widget.LinearLayout id/no_id/11
android.widget.TextView id/no_id/12
android.widget.TextView id/no_id/13
android.widget.FrameLayout id/no_id/14
android.widget.TableLayout id/no_id/15
android.widget.TableRow id/no_id/16
android.widget.TextView id/no_id/17 Sector: NULL SECTOR
android.widget.TableRow id/no_id/18
android.widget.TextView id/no_id/19 Number of Alliances:
android.widget.TextView id/no_id/20 1
android.widget.TableRow id/no_id/21
android.widget.TextView id/no_id/22 Row Name Power
android.widget.TableRow id/no_id/23
android.widget.ListView id/no_id/24
android.widget.RelativeLayout id/no_id/25
android.widget.TextView id/no_id/26 1
android.widget.TextView id/no_id/27 NULL ALLIANCE
android.widget.TextView id/no_id/28 Neutral
android.widget.TextView id/no_id/29 10000
我的 avc_addallc.py 中的以下行按下了 ActionBar 中的 New ('+') 按钮:
add = vc.findViewById('id/no_id/12').touch()
...然后打开 AddAlliance 对话框:
...具有以下视图读数:
android.widget.FrameLayout id/no_id/1
android.widget.FrameLayout id/no_id/2
android.widget.FrameLayout id/no_id/3
android.widget.LinearLayout id/no_id/4
android.widget.LinearLayout id/no_id/5
android.widget.LinearLayout id/no_id/6
android.widget.TextView id/no_id/7 New Alliance
android.view.View id/no_id/8
android.widget.FrameLayout id/no_id/9
android.widget.FrameLayout id/no_id/10
android.widget.ScrollView id/no_id/11
android.widget.RelativeLayout id/no_id/12
android.widget.TextView id/no_id/13 Sector: Helix
android.widget.TextView id/no_id/14 Alliance:
android.widget.EditText id/no_id/15 Alliance_Name
android.widget.TextView id/no_id/16 Leader:
android.widget.EditText id/no_id/17 Leader
android.widget.TextView id/no_id/18 Political Relation:
android.widget.Spinner id/no_id/19
android.widget.TextView id/no_id/20 Ally
android.widget.TextView id/no_id/21 Rank: Power:
android.widget.EditText id/no_id/22 2500
android.widget.EditText id/no_id/23 1234567
android.widget.TextView id/no_id/24 No. Players: Map Score:
android.widget.EditText id/no_id/25 100
android.widget.EditText id/no_id/26 123456789
android.widget.TextView id/no_id/27 No. Bases
android.widget.EditText id/no_id/28 8000
android.widget.LinearLayout id/no_id/29
android.widget.LinearLayout id/no_id/30
android.widget.Button id/no_id/31 Cancel
android.widget.Button id/no_id/32 Save
我的 avc_addallc.py 中的下一行应该在第一个 EditText (Alliance_Name) 中放置文本:
etAllc = vc.findViewById('id/no_id/15').type('Legion of Anarchy')
它什么也不做,但返回此错误:
130225 21:31:13.023:I [MainThread] [com.android.chimpchat.ChimpManager] Monkey Command: touch down 354 74.
130225 21:31:13.107:I [MainThread] [com.android.chimpchat.ChimpManager] Monkey Command: touch up 364 84.
130225 21:31:16.223:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
130225 21:31:16.223:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "c:\code\avc_addallc.py", line 44, in <module>
etAllc = vc.findViewById('id/no_id/15').type('Legion of Anarchy')
File "C:\adt-bundle-windows-x86\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 275, in __getattr__
raise AttributeError, name
AttributeError: type
我哪里错了?谢谢!