Lukap
Lukap

Reputation: 31963

Start monkeyrunner script on multiple devices

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

Upvotes: 1

Views: 2193

Answers (2)

Rilwan
Rilwan

Reputation: 2301

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.

Upvotes: 2

Jens
Jens

Reputation: 17087

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.

Upvotes: 0

Related Questions