0
這是我的當前項目的聯盟屏幕:安卓:Python的:AndroidViewClient菜鳥麻煩
..和本所認爲讀出使用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
我在哪裏犯了錯誤?謝謝!
感謝您關注此事... 我有的版本是2.3.7,我從https://github.com/dtmilano/AndroidViewClient下載了昨天剛纔我如何獲得2.3.8更新?否則,我很樂意進行空白/報價調整。 – Quasaur 2013-02-26 08:27:37
我下載了最新的提交(2.3.8)的viewclient.py ... 我得到了同樣的錯誤,但現在行: etAllc.type(「無政府狀態的軍團」) ..由於您之前建議的更改。 – Quasaur 2013-02-26 08:38:02
意識到我被問了很多一個對話框,我做了第2屏幕自身的活動。因此,現在必須從聯盟活動中選擇「新建」,此時AddNewAllc活動會隨窗體一起提供。我需要爲Python腳本avc_addallc.py識別新活動並將數據放置在表單中(一個必須重複8次的過程)? – Quasaur 2013-02-26 20:48:35