|
回复 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=3196154&ptid=894692]12#[/url] liutong3310
你说的太不详细了。我有遇到过一些类似的问题。单单看你的描述信息,我不清楚具体是什么原因。
############################################
就以google的voicesearch简单的写一个吧。
# -*- coding: utf-8 -*-
import time
import os
from com.android.monkeyrunner import MonkeyRunner as mr
from com.android.monkeyrunner import MonkeyDevice as md
device = mr.waitForConnection(5,'XXXXXXXXXXXXXXXX')
#if not device:
# print >> sys.stderr,"fail"
# sys.exit(1)
#APK Name "com.google.android.voicesearch"
package = 'com.google.android.voicesearch'
#Activity
activity = 'com.google.android.voicesearch.MainActivity'
print 'Start Time: '
date='echo %date%'
times='echo %time%'
os.system(date)
os.system(times)
# sets the name of the component to star
runComponent = package + '/' + activity
#Start Activity
device.startActivity(component=runComponent)
#mr.sleep(1.0)
#Input"CityName"
device.type('shanghai')
#ENTER Key
device.press('KEYCODE_ENTER')
#此部分内容偶就不展示啦,就是验证的一些东西。^_^#
print 'End Time: '
date='echo %date%'
times='echo %time%'
os.system(date)
os.system(times)
#Quit
device.press('KEYCODE_BACK')
device.press('KEYCODE_BACK')
#此部分内容偶就不展示啦,其它操作东西# |
|