TA的每日心情 无聊 4 天前
签到天数: 530 天
连续签到: 2 天
[LV.9]测试副司令
1 测试积点
初学appium,使用python写测试脚本,现在可以安装上app,之后无法自动启动app。
这是我的脚本:
#coding=utf-8
from appium import webdriver
from lib2to3.pgen2.driver import Driver
from lib2to3.tests.support import driver
import os
import time
PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(file),p))
global driver
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = 'b91b9b66'
#desired_caps['appPackage'] = 'com.zhengyuan.watch'
#desired_caps['appActivity'] = 'com.zhengyuan.watch.logic.launch.AppStart'
desired_caps['app'] = PATH('D:\android\app\rtring_c_zhengyuan.apk')
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(5)
driver.swipe(600,660,10,660,1000)
time.sleep(1)
driver.swipe(600,660,10,660,1000)
time.sleep(1)
log:
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtring_c_zhengyuan.apk","platformName":"Android"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from desired caps: D:\android\app\rtring_c_zhengyuan.apk
info: [debug] Creating new appium session 7ab051a1-8c95-4b9a-a998-f1748ed52d47
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.7.0_79
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\android\sdk\platform-tools\adb.exe
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump badging D:\android\app\rtring_c_zhengyuan.apk
info: [debug] badging package: com.zhengyuan.watch
info: [debug] badging act: com.zhengyuan.watch.logic.launch.AppStart
info: [debug] Parsed package and activity are: com.zhengyuan.watch/com.zhengyuan.watch.logic.launch.AppStart
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device b91b9b66
info: [debug] Setting device id to b91b9b66
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 wait-for-device
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language: zh
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\android\app\rtring_c_zhengyuan.apk" "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch" zh
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Users\admin\AppData\Local\Temp\com.zhengyuan.watch\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from D:\android\sdk\build-tools\android-4.4W\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\aapt.exe dump xmltree D:\android\app\rtring_c_zhengyuan.apk AndroidManifest.xml
info: [debug] Set app process to: com.zhengyuan.watch
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for D:\android\app\rtring_c_zhengyuan.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" D:\android\app\rtring_c_zhengyuan.apk
info: [debug] App already signed.
info: [debug] Zip-aligning D:\android\app\rtring_c_zhengyuan.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from D:\android\sdk\build-tools\android-4.4W\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: D:\android\sdk\build-tools\android-4.4W\zipalign.exe -f 4 D:\android\app\rtring_c_zhengyuan.apk C:\Users\admin\AppData\Local\Temp\116210-428-1fgurq6\appium.tmp
info: [debug] MD5 for app is 310a577ec209ceac8a6dee5086a1bf5d
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk"
info: [debug] Getting install status for com.zhengyuan.watch
info: [debug] Getting device API level
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm list packages -3 com.zhengyuan.watch"
info: [debug] App is installed
info: Installing App
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "mkdir -p /data/local/tmp/"
info: [debug] Removing any old apks
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ls /data/local/tmp/*.apk"
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell rm "/data/local/tmp/8f29ab35c86ad03708a23dfe9aaeeaa0.apk"
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "D:\android\app\rtring_c_zhengyuan.apk" /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk
info: [debug] Uninstalling com.zhengyuan.watch
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "am force-stop com.zhengyuan.watch"
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 uninstall com.zhengyuan.watch
info: [debug] App was uninstalled
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "pm install -r /data/local/tmp/310a577ec209ceac8a6dee5086a1bf5d.apk"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "ps 'uiautomator'"
info: [debug] Attempting to kill process 31936
info: [debug] executing cmd: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell "kill 31936"
info: [debug] Running bootstrap
info: [debug] spawning: D:\android\sdk\platform-tools\adb.exe -s b91b9b66 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.zhengyuan.watch -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
error: Unhandled error: Error: getaddrinfo ENOENT
at Object.exports.errnoException (util.js:746:11)
at errnoException (dns.js:49:15)
at GetAddrInfoReqWrap.onlookup as oncomplete context: [POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"b91b9b66","app":"D:\android\app\rtringc_zhengyuan.apk","platformName":"Android"}}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: <-- POST /wd/hub/session - - ms - -
undefined 复制代码 之后就停住了,请大家帮我看看是什么问题,纠结了好几天了,谢谢大家!
我来回答