标签:div form androi unicode aml pre local utf-8 cti
学习了yaml之后就是要将capability的各项参数值与代码分离开。
先创建一个capability.yaml文件,把各项参数存放在其中,然后用load()进行读取。
capability.yaml
platformName: Android deviceName: U4KF9HSK99999999 platformVersion: 5.1 appPackage: com.taobao.taobao appActivity: com.taobao.tao.welcome.Welcome unicodeKeyboard: True resetKeyboard: True noReset: True ip: localhost port: 4723
caps_yaml.py
from appium import webdriver import yaml file = open(‘capability.yaml‘,encoding="utf-8") data = yaml.load(file,yaml.FullLoader) desired_caps={ "platformName": data["platformName"], "platformVersion": data["platformVersion"], "deviceName": data["deviceName"], "appPackage": data["appPackage"], "appActivity": data["appActivity"], "unicodeKeyboard":data["unicodeKeyboard"], "resetKeyboard":data["resetKeyboard"], "noReset": data["noReset"] } driver = webdriver.Remote(‘http://‘+str(data[‘ip‘])+‘:‘+str(data[‘port‘])+‘/wd/hub‘,desired_caps)
python+Appium自动化:yaml配置capability
标签:div form androi unicode aml pre local utf-8 cti
原文地址:https://www.cnblogs.com/bugbreak/p/12083026.html