Document

appium-1.2-启动Android设备

1)单个Android设备启动

#server固定写法
server = 'http://localhost:4723/wd/hub'
# app启动参数
# platformName设备名称是Android还是ios
#appPackage  appActivity需要启动的包名
#
desired_caps = {
"platformName": "Android",
"deviceName": "06599afc7d24",
"appPackage": "com.taobao.idlefish",
'newCommandTimeout': "2000",
"appActivity": "com.taobao.fleamarket.home.activity.MainActivity",
"noReset":"True",
"automationName":'UiAutomator2',
'avdLaunchTimeout':'300'
}
# 驱动
driver = webdriver.Remote(server, desired_caps)
driver.implicitly_wait(30)
#隐式等待30秒,适用于后面所有的driver,都会等待30秒

备注:查询包名的方式,cmd打开

adb shell dumpsys window w |findstr \/ |findstr name=

 

2)多个Android设备启动

#多一个udid
desired_caps = {
"platformName": "Android",
"deviceName": "06599afc7d24",
  "udid":"xxxxx",
"appPackage": "com.taobao.idlefish",
'newCommandTimeout': "2000",
"appActivity": "com.taobao.fleamarket.home.activity.MainActivity",
"noReset":"True",
"automationName":'UiAutomator2',
'avdLaunchTimeout':'300'
}

备注:查询udid的方式,cmd打开

adb devices

 

 

posted on 2020-07-20 17:31  小排顾  阅读(186)  评论(0编辑  收藏  举报

导航