简介:安卓手机厂商林立造成的各系统占山为王,差异大,难以获取相关参数。HarmonyOS本质是基于安卓进行的封装优化。
获取方式有两种,推荐方式2
方式1:
鸿蒙安卓版本号:进入应用和服务 - 应用管理 - 搜索:系统 点击系统,顶部即版本号;
如果隐藏搜不到系统配置,需要先点击右上角设置成:显示系统程序
方式2:打开Android studio,通过adb connect 连接设备 或者usb连接 点击 logcat,即可查看到对应安卓版本号信息
例:
system_data = {"platformName": "Android","platformVersion": "10","deviceName": "HuaWei","noReset": True,"udid": "THF123456","appPackage": "com.tencent.mm","appActivity": "com.tencent.mm.ui.LauncherUI"
}
调试启动运行:
# -*- coding: utf-8 -*-
from selenium import webdriver
import asyncio
from appium import webdriversystem_data = {"platformName": "Android","platformVersion": "10","deviceName": "HuaWei","noReset": True,"udid": "THF123456","appPackage": "com.tencent.mm","appActivity": "com.tencent.mm.ui.LauncherUI"
}async def make_driver():url = r"http://127.0.0.1:4725" + "/wd/hub"driver = webdriver.Remote(url, desired_capabilities=system_data2)driver.implicitly_wait(5)size = driver.get_window_size()print("当前手机:华为,size:", size)return driverif __name__ == '__main__':tasks = [make_driver()]asyncio.run(asyncio.wait(tasks))
运行结果:
微信公众号:玩转测试开发
欢迎关注,共同进步,谢谢!