appium+python自动化

WubbaLubbaDubDub - 知乎

注意点:夜神模拟器的bin目录要加入path环境变量。

adb devices 查看设备连接列表
nox_adb devices -l 查看连接的设备
adb -s 1c0113fd shell dumpsys window | findstr mCurrentFocus 查看某台设备当前打开App的"appPackage"和"appActivity"。

appium连接模拟器的配置:

desired = {
    "platformName": "Android",
    "platformVersion": "9",
    "deviceName": "1c0113fd",
    "appPackage": "com.miui.home",
    "appActivity": "com.miui.home.launcher.Launcher",
    "automationName": "Appium",
    "autoAcceptAlerts": True,
    "noReset": True,
    "unicodeKeyboard": True,
    "resetKeyboard": True
}
设备号获取:adb devices
platformVersion获取:adb -s 设备号 shell getprop ro.build.version.release
deviceName获取:nox_adb devices -l
appPackage和appActivity获取:adb -s 设备号 shell dumpsys window | findstr mCurrentFocus
desired_caps = {
        "platformName": "Android",  # 操作系统
        "deviceName": "emulator-5554",  # 设备 ID
        "platformVersion": "6.0.1",  # 设备版本号
        "appPackage": "com.tencent.mm",  # app 包名
        "appActivity": "com.tencent.mm.ui.LauncherUI",  # app 启动时主 Activity
        'noReset': True,  # 是否保留 session 信息,可以避免重新登录
        'unicodeKeyboard': True,  # 使用 unicodeKeyboard 的编码方式来发送字符串
        'resetKeyboard': True  # 将键盘给隐藏起来
    }
    driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

文子阳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值