(额,各位大侠,我是新人菜鸟,求轻拍~~ps:头像不是我不想传喔,点击修改头像的链接报错 “504 网关超时”,maybe 是我网络太差吧)
问题是这样的:
包名和 activity 没有问题,执行 python 脚本,app 可以启动,但是在注册界面后,就不跑了,报错。error: Failed to start an Appium session, err was: Error: com.syswin.toon/.activity.login.WelcomeActivity never started. Current: com.syswin.toon/.activity.login.VerifyActivity
补充:今天下午在 dr = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) 后面每一行之间都加了一句 print ,跑通过一次。但是由于从注册界面进入登录界面后,输入账号密码后键盘挡住了登录按钮,失败。之后就再也没跑成功。
求各位大侠指点一下~谢谢!
----------------------------------------------------------以下是 pytho 脚本~~-------------------------------------------------------------
import unittest
import os
from appium import webdriver
from time import sleep
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.4 KTU84P'
desired_caps['deviceName'] = '11f68396'
desired_caps['appPackage'] = 'com.syswin.toon'
desired_caps['appActivity'] = '.activity.login.WelcomeActivity'
dr = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
dr.find_element_by_id("com.syswin.toon:id/tv_change_account").click()
dr.find_element_by_id("com.syswin.toon:id/et_phone").send_keys("18500231523")
dr.find_element_by_id("com.syswin.toon:id/et_password").send_keys("111111")
dr.find_element_by_id("com.syswin.toon:id/btn_login").click()
print 'login success!'
-----------------------------------------------------以下是错误报告-------------------------------------------------------------------------------------------
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4.4
KTU84P","deviceName":"11f68396","platformName":"Android","appActivity":".activit
y.login.WelcomeActivity","appPackage":"com.syswin.toon"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] Didn't get app but did get Android package, will attempt to launch
it on the device
info: [debug] Creating new appium session b3854f44-eff2-43ab-9f52-ff59676f3fcb
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_40
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it's alr
eady on the device
info: [debug] Checking whether adb is present
info: [debug] Using adb from E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 11f68396
info: [debug] Setting device id to 11f68396
info: [debug] Waiting for device to be ready and to respond to shell commands (t
imeout = 5)
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 wait-for-device
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "echo 'ready'"
info: [debug] Starting logcat capture
warn: No app capability, can't parse package/activity
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Apk doesn't exist locally
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "rm -rf /data/local/tmp/strings.json
"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an ap
p path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 push "E:\Automation2\AppiumForWindows-1.
3.4.1\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.j
ar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 install "E:\Automation2\AppiumForWindows-1
.3.4.1\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 install "E:\Automation2\AppiumForWindows-1
.3.4.1\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: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: E:\Automation2\adt-bundle-windows-x86_64-20140702\sdk\pl
atform-tools\adb.exe -s 11f68396 shell uiautomator runtest AppiumBootstrap.jar -
c io.appium.android.bootstrap.Bootstrap
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=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.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...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window"
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp
","status":0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy"
,{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action"
:"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
info: [debug] Getting device API level
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "am start -S -a android.intent.actio
n.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.syswin.toon/.act
ivity.login.WelcomeActivity"
info: [debug] Waiting for pkg "com.syswin.toon" and activity ".activity.login.We
lcomeActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: E:\Automation2\adt-bundle-windows-x86_64-20140702\s
dk\platform-tools\adb.exe -s 11f68396 shell "dumpsys window windows"
error: com.syswin.toon/.activity.login.WelcomeActivity never started. Current: c
om.syswin.toon/.activity.login.VerifyActivity
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down"
,"status":0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 22.815
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: com.syswin.toon/.activ
ity.login.WelcomeActivity never started. Current: com.syswin.toon/.activity.logi
n.VerifyActivity
info: [debug] Error: com.syswin.toon/.activity.login.WelcomeActivity never start
ed. Current: com.syswin.toon/.activity.login.VerifyActivity
at null. (E:\Automation2\AppiumForWindows-1.3.4.1\Appium\node_mod
ules\appium\node_modules\appium-adb\lib\adb.js:1298:12)
at null. (E:\Automation2\AppiumForWindows-1.3.4.1\Appium\node_mod
ules\appium\node_modules\appium-adb\lib\adb.js:1242:7)
at null. (E:\Automation2\AppiumForWindows-1.3.4.1\Appium\node_mod
ules\appium\node_modules\appium-adb\lib\adb.js:172:9)
at ChildProcess.exithandler (child_process.js:735:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"
A new session could not be created. (Original error: com.syswin.toon/.activity.l
ogin.WelcomeActivity never started. Current: com.syswin.toon/.activity.login.Ver
ifyActivity)","origValue":"com.syswin.toon/.activity.login.WelcomeActivity never
started. Current: com.syswin.toon/.activity.login.VerifyActivity"},"sessionId":
null}
info: <-- POST /wd/hub/session 500 46583.539 ms - 358