Start monkeyrunner script on multiple devices

2.2k Views Asked by At

I have a script that should be run on two devices at same time, this two devices are connected to one pc.

How can I run the script on both devices at the same time ?

is there some option like -s "SERIAL_NUMBER" , or something l

2

There are 2 best solutions below

2
On BEST ANSWER

Adjust your script slightly - add a device-id parameter & use that when creating your MonkeyDevice.

MonkeyRunner#waitForConnection(float, string) can take a timeout and a device identifier to start the script on an specific device.

0
On

try this:-

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
import os
devices = os.popen('adb devices').read().strip().split('\n')[1:];
deviceid = devices[0].split('\t')[0];
device = MonkeyRunner.waitForConnection('',deviceid)

hope works.