代码实现
参数配置表:desired_caps.yaml
platformName: Android deviceName: 192.168.175.101:5555 platformVersion: 5.1 app: C:UserszARTDesktopapp-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)