eclipse + python + monkeyrunner環境搭建

來源:互聯網
上載者:User

標籤:

安裝python

http://pydev.org/updates

載入python.exe

jython 載入jython 包 , 載入Hier包 chilm包

 

》》》》》》》》》》》》》》》》》》》》》》》》》》

 

monkeyrunner 錄製回放指令碼,儲存為mr_rocorder.py

from com.android.monkeyrunner import MonkeyRunner as mr

from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder

device = mr.waitForConnection()

recorder.start(device)

運行monkeyrunner mr_rocorder.py

monkeyplayback.py

 import sys

    com.android.monkeyrunner import MonkeyRunner

    # The format of the file we are parsing is very carfeully constructed.

    # Each line corresponds to a single command. The line is split into 2

    # parts with a | character. Text to the left of the pipe denotes

    # which command to run. The text to the right of the pipe is a python

    # dictionary (it can be evaled into existence) that specifies the

    # arguments for the command. In most cases, this directly maps to the

    # keyword argument dictionary that could be passed to the underlying

    # command.

    # Lookup table to map command strings to functions that implement that

    # command.

    CMD_MAP = {

    ""TOUCH"": lambda dev, arg: dev.touch(**arg),

    ""DRAG"": lambda dev, arg: dev.drag(**arg),

    ""PRESS"": lambda dev, arg: dev.press(**arg),

    ""TYPE"": lambda dev, arg: dev.type(**arg),

    ""WAIT"": lambda dev, arg: MonkeyRunner.sleep(**arg)

    }

    # Process a single file for the specified device.

    def process_file(fp, device):

    for line in fp:

    (cmd, rest) = line.split(""|"")

    try:

    # Parse the pydict

    rest = eval(rest)

    except:

    print ""unable to parse options""

    continue

    if cmd not in CMD_MAP:

    print ""unknown command: "" + cmd

    continue

    CMD_MAP[cmd](device, rest)

    def main(): 

    file = sys.argv[1]

    fp = open(file, ""r"")

    device = MonkeyRunner.waitForConnection()

    process_file(fp, device)

    fp.close();

    if __name__ == ""__main__"":

    main()

 

運行monkeyplayback.py + 錄製的檔案名稱

 

安裝findbugs:http://findbugs.cs.umd.edu/eclipse  在eclipse中安裝

使用tcpdump及wireshark 抓包:

adb push <tcpdump path>  /data/local/tcpdump

adb shell chmod 6755 /data/local/tcpdump

adb shell

cd /data/local

tcpdump -p -vv -s 0 -w /data/local/capture.pcap

adb pull /data/local/capture.pcap D:\

分析網路耗時、網路通訊協定 IP地址等

詳細查看TCP、ip協議卷一到卷三

 

eclipse + python + monkeyrunner環境搭建

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.