I am trying to run monkeyrunner script on multiple devices in order to perform some basic operations. I realized that first I will start writing a script to perform basic operations on two connected devices.
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
import time
import sys
import time
devices = os.popen('adb devices').read().strip().split('\n')[1:]
device1 = MonkeyRunner.waitForConnection( devices[0].split('\t')[0])
package = 'com.android.browser'
activity = 'com.android.browser.BrowserActivity'
runComponent = package + '/' + activity
device1.startActivity(component=runComponent)
MonkeyRunner.sleep(1)
device2 = MonkeyRunner.waitForConnection( devices[1].split('\t')[0])
package = 'com.android.browser'
activity = 'com.android.browser.BrowserActivity'
runComponent = package + '/' + activity
device2.startActivity(component=runComponent)
When I run this script, it never completes execution. The browser takes place on one of the connected devices, but not on the other. Can you guys help me fix this, or if you have the best code (ideas) for running activity on multiple devices, Please let me know ~ I am new and completely new to the programming world! thanks in advance
source
share