monkeyrunner

getProperty & getSystemProperty in MonkeyRunner return None


I'm new to Android development and test, currently I'm training to make a test scripts under Python and then use monkeyrunner to run them.

As said in MonkeyDevice official documentation , the [getProperty()][1] and [getSystemProperty()][2] should return you a value that depends on property variable name you pass for them. Each time I got only 'None' value. Any idea or trick?!

The simple code I'm using :

from com.android.monkeyrunner import MonkeyDevice,MonkeyRunner

device = MonkeyRunner.waitForConnection()

print device.getSystemProperty('version.sdk')

Regards,,,


Solution

  • You need to specify the property group. For example:

    print device.getSystemProperty('build.version.sdk')