elleryq
12/4/2014 - 9:36 AM

MonkeyRunner and AndroidViewClient example. Detect whether the call is coming.

MonkeyRunner and AndroidViewClient example. Detect whether the call is coming.

import sys

# put jar into sys.path
sys.path.append(os.path.join("your_path", "androidviewclient-2.3.25.jar"))

from com.dtmilano.android.viewclient import ViewClient

# if you connect multiple device, you can specify serialno
# you can get serialno via 'adb devices'
device, serialno = ViewClient.connectToDeviceOrExit(
    verbose=True,
    serialno=serialno)
vc = ViewClient(
    device=self.device,
    serialno=serialno)

# Must call dump() to refresh vc.root
vc.dump()
widget = self.vc.findViewWithText('Incoming call')