Appium环境搭建并连接真实设备
adb devices 获取 devicesName
PS C:\Users\XXX> adb devices
List of devices attached
793QBDR7222BR device
1 PS C:\Users\X> adb -s 793QBDR7222BR shell dumpsys activity 2 3 ACTIVITY MANAGER PENDING INTENTS (dumpsys activity intents) 4 * PendingIntentRecord{aaa790b com.meizu.cloud broadcastIntent (whitelist: +30s0ms)} 5 * PendingIntentRecord{bbeadf0 com.meizu.flyme.xtemui broadcastIntent} 6 * PendingIntentRecord{cf5f69 com.meizu.assistant startActivity} 7 * PendingIntentRecord{34503f3 com.meizu.cloud broadcastIntent (whitelist: +30s0ms)} 8 9 搜索 mFocusedActivity
mFocusedActivity: ActivityRecord{f408b5b u0 com.example.haier_test/.MainActivity t767}
启动脚本
1 from appium import webdriver 2 from appium.webdriver.common.touch_action import TouchAction 3 4 caps = {} 5 caps["platformName"] = "android" 6 caps["deviceName"] = "793QBDR7222BR" 7 caps["appPackage"] = "com.example.haier_test" 8 caps["appActivity"] = ".MainActivity" 9 caps["autoGrantPermissions"] = "true" 10 11 driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) 12 driver.implicitly_wait(10)