0
我想實現Androidviewclient運行viewbased腳本包,有沒有什麼辦法可以使用androidviewclient喜歡,我們可以用" device.installPackage()monkeyrunner的方式安裝新的軟件包"安裝使用的是Android viewClient
我想實現Androidviewclient運行viewbased腳本包,有沒有什麼辦法可以使用androidviewclient喜歡,我們可以用" device.installPackage()monkeyrunner的方式安裝新的軟件包"安裝使用的是Android viewClient
AndroidViewClient/culebra版本11.0.7器具ViewClient.installPackage()
和還引入了基於所述安裝APK的結果的試驗的先決條件的新命令行選項--install-apk
。詳情請參閱https://github.com/dtmilano/AndroidViewClient/wiki/Test-Cookbook#installing-apks-as-preconditions。
installPackage
尚未在AdbClient
實現,因爲它可以通過subprocess
替代:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2014 Diego Torres Milano
Created on 2015-11-14 by Culebra v10.8.2
__ __ __ __
/\/\/\/\
____________________/ __\/ __\/ __\/ __\_____________________________
___________________/ /__/ /__/ /__/ /________________________________
|/\ /\ /\ /\ \___
|/ \_/ \_/ \_/ \ o \
\_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''
import re
import sys
import os
import subprocess
try:
sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
from com.dtmilano.android.viewclient import ViewClient
TAG = 'CULEBRA'
_s = 5
_v = '--verbose' in sys.argv
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': False, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True}
vc = ViewClient(device, serialno, **kwargs2)
apk="/path/to/my/app-debug.apk"
subprocess.check_call([vc.adb, "install", "-r", apk], shell=False)