Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created December 4, 2014 09:36
Show Gist options
  • Save elleryq/417736aad84ccc63368e to your computer and use it in GitHub Desktop.
Save elleryq/417736aad84ccc63368e to your computer and use it in GitHub Desktop.
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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment