def startapp(self, activity=apkmess(settings.APKPATH).launchable_activity): ''' :param activityName: android activity name :return: driver ''' desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = mobilehard(self.device).mobile_android_version desired_caps['deviceName'] = self.device app_info = apkmess(settings.APKPATH) desired_caps['appPackage'] = app_info.package_name desired_caps['appActivity'] = activity try: appiumautolog().debug(u'appium启动信息 %s' % desired_caps) self.driver = webdriver.Remote(settings.APPIUMSERVER, desired_caps) except URLError, e: appiumautolog().error(u'请检果appium服务器地址是否正确! \t %s ' % e)
def startapp(self, activity=apkmess(settings.APKPATH).launchable_activity): ''' :param activityName: android activity name :return: driver ''' desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = mobilehard( self.device).mobile_android_version desired_caps['deviceName'] = self.device app_info = apkmess(settings.APKPATH) desired_caps['appPackage'] = app_info.package_name desired_caps['appActivity'] = activity try: appiumautolog().debug(u'appium启动信息 %s' % desired_caps) self.driver = webdriver.Remote(settings.APPIUMSERVER, desired_caps) except URLError, e: appiumautolog().error(u'请检果appium服务器地址是否正确! \t %s ' % e)
def coverinstall(self, apkpath = settings.APKPATH): ''' :param apkpath: 需要被安装的app的路径,默认为配置文件路径 :return:Ture or False ''' ins_command = AdbCommand(self.device).shell.get("coverInd") + ' ' + apkpath run = mobilehard(self.device).execadbshell(ins_command) if run: result = [x for x in run if x!='\n'][1] if re.match(r"^Failure*", result): appiumautolog().error(u"此版本不能覆盖比自己高的版本!") return False elif re.match(r"^Success*", result): return True else: appiumautolog().error(u"adb命令运行有误!") raise Exception(u"adb命令运行有误!") else: appiumautolog().error(u"adb命令运行有误!") raise Exception(u"adb命令运行有误!")
def coverinstall(self, apkpath=settings.APKPATH): ''' :param apkpath: 需要被安装的app的路径,默认为配置文件路径 :return:Ture or False ''' ins_command = AdbCommand( self.device).shell.get("coverInd") + ' ' + apkpath run = mobilehard(self.device).execadbshell(ins_command) if run: result = [x for x in run if x != '\n'][1] if re.match(r"^Failure*", result): appiumautolog().error(u"此版本不能覆盖比自己高的版本!") return False elif re.match(r"^Success*", result): return True else: appiumautolog().error(u"adb命令运行有误!") raise Exception(u"adb命令运行有误!") else: appiumautolog().error(u"adb命令运行有误!") raise Exception(u"adb命令运行有误!")