Ejemplo n.º 1
0
    def __init__(self):

        self.devices = adbCommon.AndroidDebugBridge().attachedDevices()
        self.platformVersion = phoneBase.getPhoneInfo(self.devices)['release']
        self.appPackage = apkBaseInfo.ApkInfo(apkPath).getApkName()
        self.appActivity = apkBaseInfo.ApkInfo(apkPath).getApkActivity()
        self.config = configparser.ConfigParser()
        self.port = configReadInfo.ReadConfig().readDeviceInfo()['port']
        self.platformName = configReadInfo.ReadConfig().readDeviceInfo(
        )['platformName']
Ejemplo n.º 2
0
def open_app(packagename, activity):
    return adbCommon.AndroidDebugBridge().open_app(packagename, activity)
Ejemplo n.º 3
0
def attached_devices():
    return adbCommon.AndroidDebugBridge().attached_devices()
Ejemplo n.º 4
0
__author__ = 'Never deter till tomorrow that which you can do today. _20180131'
# -*- coding: utf-8 -*-
import os, math, subprocess
from testDAL import adbCommon

device = adbCommon.AndroidDebugBridge().attachedDevices()


#获取手机版本,型号,品牌,设备名
def getPhoneInfo(devices):
    cmd = "adb -s " + devices + " shell cat /system/build.prop "
    phone_info = subprocess.Popen(cmd, shell=True,
                                  stdout=subprocess.PIPE).stdout.readlines()

    phone_list = {}
    release = "ro.build.version.release="  # 版本
    model = "ro.product.model="  #型号
    brand = "ro.product.brand="  # 品牌
    device = "ro.product.device="  # 设备名
    try:
        for line in phone_info:
            for i in line.split():
                temp = i.decode()
                if temp.find(release) >= 0:
                    phone_list["release"] = temp[len(release):]
                    break
                if temp.find(model) >= 0:
                    phone_list["model"] = temp[len(model):]
                    break
                if temp.find(brand) >= 0:
                    phone_list["brand"] = temp[len(brand):]