zoukankan      html  css  js  c++  java
  • monkeyrunner操作多个设备的例子

    # -*- coding: utf-8 -*-
     
    from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice
    from com.android.monkeyrunner.easy import EasyMonkeyDevice
    from com.android.monkeyrunner.easy import By
     
    def main():
    device1 = MonkeyRunner.waitForConnection(5.0, '1123456789ABCDEF')
    if not device1:
    print("device1 connection fail")
    else:
    print("device1 connection success")
    device2 = MonkeyRunner.waitForConnection(5.0, '0123456789ABCDEF')
    if not device2:
    print("device2 connection fail")
    else:
    print("device2 connection success")
    device1.startActivity(component="com.aliyun.wireless.vos.appstore/com.aliyun.wireless.vos.appstore.SlideActivity")
    MonkeyRunner.sleep(5)
    device2.startActivity(component="com.android.settings/com.android.settings.Settings")
     
    if __name__ == "__main__":
    main()
     
    注意:(1)5.0是非常有必要加的,它不是指执行多久,而是多久才执行。
  • 相关阅读:
    Best code水题之路
    我的CodeF水A题之路
    studing(来自转载)
    BFS
    fibonacci数列(五种)
    Redis阻塞队列原理学习
    the enum hack
    Divide Two Integers
    Surrounded Regions
    Search in Rotated Sorted Array
  • 原文地址:https://www.cnblogs.com/LittleRedPoint/p/3929576.html
Copyright © 2011-2022 走看看