python+appium启动APP
from appium import webdriver import readConfig import GetDevices import time from time import sleep def appdriver(): '''初始化测试环境,启动测试app''' conf = readConfig.Readconfig() cmd = GetDevices.devices() url="xxx" deviceName=conf.getConfigValue('deviceName') # platformVersion = conf.getConfigValue('platformVersion') # platformVersion = cmd.get_platformVersion().encode('ascii') platformName = conf.getConfigValue('platformName') appPackage = conf.getConfigValue('appPackage') appActivity = conf.getConfigValue('appActivity') automationName= conf.getConfigValue('automationName') u"启动app接口" desired_caps = {} desired_caps['platformName'] = platformName desired_caps['deviceName'] = deviceName desired_caps['automationName'] = automationName # desired_caps['platformVersion'] = platformVersion desired_caps['appPackage'] = appPackage desired_caps['appActivity'] = appActivity desired_caps['resetKeyboard'] = 'true' desired_caps['unicodeKeyboard'] = 'true' desired_caps['noReset'] = True # appium1.6以后的版本需要这个设置才可以保存app的登录状态 driver = webdriver.Remote(command_executor = url, desired_capabilities = desired_caps) return driver if __name__ == '__main__': test_device = appdriver()