python3+Appium自动化09-Capability配置数据分离实践

代码实现

参数配置表:desired_caps.yaml

platformName: Android
deviceName: 192.168.175.101:5555
platformVersion: 5.1
app: C:\Users\bzART\Desktop\app-artmall-release.apk
appPackage: com.baozhenart.artmall
appActivity: com.baozhenart.artmall.SplashActivity
noReset: True
unicodeKeyboard: True
resetKeyboard: True
ip: 127.0.0.1
port: 4723

读取配置表:capability_yaml.py

#coding=utf-8
from appium import webdriver
import yaml

file=open('desired_caps.yaml','r')
data=yaml.load(file)
print(data)
driver = webdriver.Remote('http://'+str(data['ip'])+':'+str(data['port'])+'/wd/hub', data)

 

posted on 2018-07-12 10:12  深海溺心  阅读(155)  评论(0编辑  收藏  举报

导航