adbOptions.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Zeuz_Python_Node 作者: AutomationSolutionz 项目源码 文件源码
def get_devices():
    ''' Retrieves a list of connected devices in the format of "SERIAL_NO STATE" and returns as a list '''
    # State may be "device" if connected and we can talk to it, or "unauthorized" if we can't talk to it

    sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
    try:
        # Get list of connected devices
        output = subprocess.check_output("adb devices", shell=True)

        # Cleanup data
        output = output.replace("\r", '')
        output = output.replace("\t", ' ')
        output = output.split("\n")
        output.pop(0)  # Remove "list of..." string
        output = [line for line in output if line != '']

        # Return as list
        CommonUtil.ExecLog(sModuleInfo, "Connected devices: %s" % str(output), 0)
        return output

    except Exception:
        CommonUtil.ExecLog(sModuleInfo, "Unable to get devices", 3)
        return []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号