MonkeyRunner_MonkeyRunner实例收集

以下是MonkeyRunner的一些实例,大家可以参考:

例句1:
device.press("DPAD_DOWN", MonkeyDevice.DOWN_AND_UP) or device.press("DPAD_UP", MonkeyDevice.DOWN_AND_UP)

例句2:

to reach the particular button and then click that button using device.press("DPAD_CENTER", MonkeyDevice.DOWN_AND_UP)

例句3:

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice  
from com.android.monkeyrunner.easy import EasyMonkeyDevice, By  
device = MonkeyRunner.waitForConnection()  
easy_device = EasyMonkeyDevice(device)  
# Start your android app
# touch the view by id
easy_device.touch(By.id('view_id'), MonkeyDevice.DOWN_AND_UP)

例句4:

device.getProperty("display.width"),device.getProperty("display.height") and device.getProperty("display.density")

例句5:

print str(device.getProperty('build.model')) #获得手机型号

print str(device.getProperty('build.board')) #获得手机型号

print str(device.getProperty('build.device')) #获得手机型号


例句6:

print str(device.getProperty('build.fingerprint'))  #结果为:Meizi/meizi_m9/m9:2.3.5/GRJ90/eng.mobileapp.20120110.135237:user/test-keys

print str(device.getProperty('build.brand'))  #结果为:1326174777000



你可能感兴趣的:(android,UP,手机,import,button)