51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1149|回复: 3
打印 上一主题 下一主题

[Appium] 使用手机可以启动进入应用,但是任何操作都不行。

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2017-11-23 13:34:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
测试环境:Appium v1.4.16+android6.0.1
测试代码如下:
  1. #coding=utf-8
  2. from appium import webdriver

  3. desired_caps = {}
  4. desired_caps['platformName'] = 'Android'
  5. desired_caps['platformVersion'] = '6.0'
  6. desired_caps['deviceName'] = '1df0f13d'
  7. desired_caps['appPackage'] = 'com.android.calculator2'
  8. desired_caps['appActivity'] = '.Calculator'

  9. driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

  10. driver.find_element_by_name("1").click()

  11. driver.find_element_by_name("5").click()

  12. driver.find_element_by_name("9").click()

  13. driver.find_element_by_name("delete").click()

  14. driver.find_element_by_name("9").click()

  15. driver.find_element_by_name("5").click()

  16. driver.find_element_by_name("+").click()

  17. driver.find_element_by_name("6").click()

  18. driver.find_element_by_name("=").click()

  19. driver.quit()
复制代码


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2017-11-23 13:36:19 | 只看该作者
测试时可以进入计算器,但是点击就报错了,
  1. > info: --> POST /wd/hub/session {"desiredCapabilities":{"deviceName":"1df0f13d","appActivity":".Calculator","platformVersion":"6.0","appPackage":"com.android.calculator2","platformName":"Android"}}
  2. > info: Client User-Agent string: Python-urllib/3.5
  3. > info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
  4. > info: [debug] Creating new appium session bbb18055-561a-40a2-bfc5-bf93b7c9069d
  5. > info: Starting android appium
  6. > info: [debug] Getting Java version
  7. > info: Java version is: 1.8.0_91
  8. > info: [debug] Checking whether adb is present
  9. > info: [debug] Using adb from E:\android-sdk\platform-tools\adb.exe
  10. > warn: No app capability, can't parse package/activity
  11. > info: [debug] Using fast reset? false
  12. > info: [debug] Preparing device for session
  13. > info: [debug] Not checking whether app is present since we are assuming it's already on the device
  14. > info: Retrieving device
  15. > info: [debug] Trying to find a connected android device
  16. > info: [debug] Getting connected devices...
  17. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe devices
  18. > info: [debug] 1 device(s) connected
  19. > info: Found device 1df0f13d
  20. > info: [debug] Setting device id to 1df0f13d
  21. > info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
  22. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d wait-for-device
  23. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "echo 'ready'"
  24. > info: [debug] Starting logcat capture
  25. > info: [debug] Getting device API level
  26. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "getprop ro.build.version.sdk"
  27. > info: [debug] Device is at API Level 23
  28. > info: Device API level is: 23
  29. > info: [debug] Extracting strings for language: default
  30. > info: [debug] Apk doesn't exist locally
  31. > info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
  32. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "rm -rf /data/local/tmp/strings.json"
  33. > info: [debug] Not uninstalling app since server not started with --full-reset
  34. > info: [debug] Skipping install since we launched with a package instead of an app path
  35. > info: [debug] Forwarding system:4724 to device:4724
  36. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d forward tcp:4724 tcp:4724
  37. > info: [debug] Pushing appium bootstrap to device...
  38. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
  39. > info: [debug] Pushing settings apk to device...
  40. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
  41. > info: [debug] Pushing unlock helper app to device...
  42. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
  43. > info: Starting App
  44. > info: [debug] Attempting to kill all 'uiautomator' processes
  45. > info: [debug] Getting all processes with 'uiautomator'
  46. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "ps 'uiautomator'"
  47. > info: [debug] No matching processes found
  48. > info: [debug] Running bootstrap
  49. > info: [debug] spawning: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.calculator2 -e disableAndroidWatchers false
  50. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  51. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  52. > info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
  53. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  54. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  55. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  56. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  57. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
  58. > info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
  59. > info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
  60. > info: [debug] [BOOTSTRAP] [debug] Loading json...
  61. > info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
  62. > info: [debug] Waking up device if it's not alive
  63. > info: [debug] Pushing command to appium work queue: ["wake",{}]
  64. > info: [debug] [BOOTSTRAP] [debug] Client connected
  65. > info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
  66. > info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  67. > info: [debug] [BOOTSTRAP] [debug] Got command action: wake
  68. > info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
  69. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window"
  70. > info: [debug] Screen already unlocked, continuing.
  71. > info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
  72. > info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
复制代码


回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2017-11-23 13:36:43 | 只看该作者
  1. > info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  2. > info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
  3. > info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data"}
  4. > info: [debug] dataDir set to: /data
  5. > info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
  6. > info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
  7. > info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
  8. > info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
  9. > info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
  10. > info: [debug] Getting device API level
  11. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "getprop ro.build.version.sdk"
  12. > info: [debug] Device is at API Level 23
  13. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.android.calculator2/.Calculator"
  14. > info: [debug] Waiting for pkg "com.android.calculator2" and activity ".Calculator" to be focused
  15. > info: [debug] Getting focused package and activity
  16. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  17. > info: [debug] Getting focused package and activity
  18. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  19. > info: [debug] Getting focused package and activity
  20. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  21. > info: [debug] Getting focused package and activity
  22. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  23. > info: [debug] Getting focused package and activity
  24. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  25. > info: [debug] Getting focused package and activity
  26. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  27. > info: [debug] Getting focused package and activity
  28. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  29. > info: [debug] Getting focused package and activity
  30. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  31. > info: [debug] Getting focused package and activity
  32. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  33. > info: [debug] Getting focused package and activity
  34. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  35. > info: [debug] Getting focused package and activity
  36. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  37. > info: [debug] Getting focused package and activity
  38. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  39. > info: [debug] Getting focused package and activity
  40. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  41. > info: [debug] Getting focused package and activity
  42. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  43. > info: [debug] Getting focused package and activity
  44. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  45. > info: [debug] Getting focused package and activity
  46. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  47. > info: [debug] Getting focused package and activity
  48. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  49. > info: [debug] Getting focused package and activity
  50. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  51. > info: [debug] Getting focused package and activity
  52. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  53. > info: [debug] Getting focused package and activity
  54. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  55. > info: [debug] Getting focused package and activity
  56. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  57. > info: [debug] Getting focused package and activity
  58. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  59. > info: [debug] Getting focused package and activity
  60. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  61. > info: [debug] Getting focused package and activity
  62. > info: [debug] executing cmd: E:\android-sdk\platform-tools\adb.exe -s 1df0f13d shell "dumpsys window windows"
  63. > error: com.android.calculator2/.Calculator never started. Current: com.android.calculator2/.Calculator,
  64. > info: [debug] Stopping logcat capture
  65. > info: [debug] Logcat terminated with code null, signal SIGTERM
  66. > info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
  67. > info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
  68. > info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
  69. > info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
  70. > info: [debug] [BOOTSTRAP] [debug] Closed client connection
  71. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
  72. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
  73. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  74. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
  75. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
  76. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
  77. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
  78. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
  79. > info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
  80. > info: [debug] [UIAUTOMATOR STDOUT] Time: 22.544
  81. > info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
  82. > info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
  83. > info: [debug] UiAutomator shut down normally
  84. > info: [debug] Cleaning up android objects
  85. > info: [debug] Cleaning up appium session
  86. > error: Failed to start an Appium session, err was: Error: com.android.calculator2/.Calculator never started. Current: com.android.calculator2/.Calculator,
  87. > info: [debug] Error: com.android.calculator2/.Calculator never started. Current: com.android.calculator2/.Calculator,
  88. > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1314:12)
  89. > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1258:7)
  90. > at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
  91. > at ChildProcess.exithandler (child_process.js:742:7)
  92. > at ChildProcess.emit (events.js:110:17)
  93. > at maybeClose (child_process.js:1016:16)
  94. > at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
  95. > info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: com.android.calculator2/.Calculator never started. Current: com.android.calculator2/.Calculator,)","origValue":"com.android.calculator2/.Calculator never started. Current: com.android.calculator2/.Calculator,"},"sessionId":null}
  96. > info: <-- POST /wd/hub/session 500 26817.004 ms - 314
复制代码

来个好人帮忙,谢谢!!

解决方式:更新到新版本,安装了1.6.4的desktop就可以了。


回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2017-11-23 13:46:12 | 只看该作者
换手机或者更新Appium版本可以解决或者直接下载了个appium desktop就可以了。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-15 01:00 , Processed in 0.067542 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表