当前位置:   article > 正文

【已解决】【Appium】请教,Appium配置正常,但是运行脚本异常停止,提示[UiAutomator] Moving to state ‘stopped‘_moving to state 'stopped

moving to state 'stopped

【2022.03.26】

更新说明

其实谈不上更新,没有什么干货

只是近期还会收到很多朋友的私信这个问题,补充一句:

这个问题是5年之前的问题了,随着框架的优化与完善,即使相同的log,解决方案也不一定是之前的了。所以现阶段可能不会有太多帮助,请谅解!

-------分割线------

【已解决】

Appium默认的UiAutomator支持API 17以上,也就是Android 4.1以上,所以重新配置AVD就好了

如果需要使用Android4.1以下版本,需要搭建配置selendroid

------------------------------分割线-------------------------------------------------------------------

Appium已经正常配置

正常开启AVD

开启Appium服务

运行脚本(脚本中的Android配置与PC上的模拟器一致)

  1. #coding=utf-8
  2. from appium import webdriver
  3. desired_caps = {}
  4. desired_caps['platformName'] = 'Android'
  5. desired_caps['platformVersion'] = '2.3.3'
  6. desired_caps['deviceName'] = 'emulator-5554'
  7. desired_caps['appPackage'] = 'com.android.calculator2'
  8. desired_caps['appActivity'] = .Calculator'
  9. driver = webdriver.Remote('http://127.0.0.1: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()


然后Appium窗口显示log结尾如下后就停止不动了:

全部log如下:

  1. C:\Users\Administrator>appium
  2. [Appium] Welcome to Appium v1.6.5
  3. [Appium] Appium REST http interface listener started on 0.0.0.0:4723
  4. [HTTP] --> POST /wd/hub/session {"capabilities":{"firstMatch":[{}],"alwaysMatch"
  5. :{"platformName":"Android"}},"desiredCapabilities":{"platformName":"Android","pl
  6. atformVersion":"2.3.3","deviceName":"emulator-5554","appPackage":"com.android.ca
  7. lculator2","appActivity":"com.android.calculator2.Calculator"}}
  8. [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformNam
  9. e":"Android","platformVersion":"2.3.3","deviceName":"emulator-5554","appPackage"
  10. :"com.android.calculator2","appActivity":"com.android.calculator2.Calculator"},n
  11. ull,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android"}}]
  12. [debug] [BaseDriver] Event 'newSessionRequested' logged at 1505719363333 (15:22:
  13. 43 GMT+0800 (中国标准时间))
  14. [Appium] Creating new AndroidDriver (v1.20.0) session
  15. [Appium] Capabilities:
  16. [Appium] platformName: 'Android'
  17. [Appium] platformVersion: '2.3.3'
  18. [Appium] deviceName: 'emulator-5554'
  19. [Appium] appPackage: 'com.android.calculator2'
  20. [Appium] appActivity: 'com.android.calculator2.Calculator'
  21. [debug] [AndroidDriver] AndroidDriver version: 1.20.0
  22. [BaseDriver] Session created with session id: eb7f6dab-bf89-4901-8341-c32f369204
  23. ad
  24. [debug] [AndroidDriver] Getting Java version
  25. [AndroidDriver] Java version is: 1.8.0_91
  26. [ADB] Checking whether adb is present
  27. [ADB] Using adb.exe from D:\android-sdk-windows\platform-tools\adb.exe
  28. [AndroidDriver] Retrieving device list
  29. [debug] [ADB] Trying to find a connected android device
  30. [debug] [ADB] Getting connected devices...
  31. [debug] [ADB] 1 device(s) connected
  32. [AndroidDriver] Looking for a device with Android '2.3.3'
  33. [debug] [ADB] Setting device id to emulator-5554
  34. [ADB] Getting device platform version
  35. [debug] [ADB] Getting connected devices...
  36. [debug] [ADB] 1 device(s) connected
  37. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  38. ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
  39. [AndroidDriver] Using device: emulator-5554
  40. [ADB] Checking whether adb is present
  41. [ADB] Using adb.exe from D:\android-sdk-windows\platform-tools\adb.exe
  42. [debug] [ADB] Setting device id to emulator-5554
  43. [AndroidDriver] App file was not listed, instead we're going to run com.android.
  44. calculator2 directly on the device
  45. [debug] [AndroidDriver] Checking whether package is present on the device
  46. [debug] [ADB] Getting connected devices...
  47. [debug] [ADB] 1 device(s) connected
  48. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  49. ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","com.android.cal
  50. culator2"]
  51. [AndroidDriver] Starting Android session
  52. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  53. ["-P",5037,"-s","emulator-5554","wait-for-device"]
  54. [debug] [ADB] Getting connected devices...
  55. [debug] [ADB] 1 device(s) connected
  56. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  57. ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
  58. [debug] [Logcat] Starting logcat capture
  59. [debug] [AndroidDriver] Pushing settings apk to device...
  60. [debug] [ADB] Getting install status for io.appium.settings
  61. [debug] [ADB] Getting connected devices...
  62. [debug] [ADB] 1 device(s) connected
  63. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  64. ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.setti
  65. ngs"]
  66. [debug] [ADB] App is not installed
  67. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  68. ["-P",5037,"-s","emulator-5554","install","C:\\Users\\Administrator\\AppData\\R
  69. oaming\\npm\\node_modules\\appium\\node_modules\\io.appium.settings\\app\\build\
  70. \outputs\\apk\\settings_apk-debug.apk"]
  71. [debug] [ADB] Getting connected devices...
  72. [debug] [ADB] 1 device(s) connected
  73. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  74. ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
  75. [debug] [ADB] Device API level: 10
  76. [debug] [ADB] Getting connected devices...
  77. [debug] [ADB] 1 device(s) connected
  78. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  79. ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings
  80. "]
  81. [debug] [AndroidDriver] Pushing unlock helper app to device...
  82. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  83. ["-P",5037,"-s","emulator-5554","install","C:\\Users\\Administrator\\AppData\\R
  84. oaming\\npm\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-
  85. debug.apk"]
  86. [debug] [ADB] Device API level: 10
  87. [debug] [ADB] Getting connected devices...
  88. [debug] [ADB] 1 device(s) connected
  89. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  90. ["-P",5037,"-s","emulator-5554","shell","settings","put","secure","mock_locatio
  91. n","1"]
  92. [ADB] Getting device platform version
  93. [debug] [ADB] Getting connected devices...
  94. [debug] [ADB] 1 device(s) connected
  95. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  96. ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
  97. [debug] [ADB] Getting connected devices...
  98. [debug] [ADB] 1 device(s) connected
  99. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  100. ["-P",5037,"-s","emulator-5554","shell","wm","size"]
  101. [debug] [ADB] Getting connected devices...
  102. [debug] [ADB] 1 device(s) connected
  103. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  104. ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
  105. [debug] [ADB] Current device property 'ro.product.model': sdk
  106. [debug] [ADB] Getting connected devices...
  107. [debug] [ADB] 1 device(s) connected
  108. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  109. ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
  110. [debug] [ADB] Current device property 'ro.product.manufacturer': unknown
  111. [AndroidDriver] No app sent in, not parsing package/activity
  112. [debug] [AndroidDriver] No app capability. Assuming it is already on the device
  113. [debug] [AndroidDriver] Running fast reset (stop and clear)
  114. [debug] [ADB] Getting connected devices...
  115. [debug] [ADB] 1 device(s) connected
  116. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  117. ["-P",5037,"-s","emulator-5554","shell","am","force-stop","com.android.calculat
  118. or2"]
  119. [debug] [ADB] Getting connected devices...
  120. [debug] [ADB] 1 device(s) connected
  121. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  122. ["-P",5037,"-s","emulator-5554","shell","pm","clear","com.android.calculator2"]
  123. [debug] [AndroidBootstrap] Watching for bootstrap disconnect
  124. [debug] [ADB] Forwarding system: 4724 to device: 4724
  125. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  126. ["-P",5037,"-s","emulator-5554","forward","tcp:4724","tcp:4724"]
  127. [debug] [UiAutomator] Starting UiAutomator
  128. [debug] [UiAutomator] Moving to state 'starting'
  129. [debug] [UiAutomator] Parsing uiautomator jar
  130. [debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
  131. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  132. ["-P",5037,"-s","emulator-5554","push","C:\\Users\\Administrator\\AppData\\Roam
  133. ing\\npm\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstra
  134. p\\bin\\AppiumBootstrap.jar","/data/local/tmp/"]
  135. [debug] [ADB] Attempting to kill all uiautomator processes
  136. [debug] [ADB] Getting all processes with uiautomator
  137. [debug] [ADB] Getting connected devices...
  138. [debug] [ADB] 1 device(s) connected
  139. [debug] [ADB] Running 'D:\android-sdk-windows\platform-tools\adb.exe' with args:
  140. ["-P",5037,"-s","emulator-5554","shell","ps"]
  141. [ADB] No uiautomator process found to kill, continuing...
  142. [debug] [UiAutomator] Starting UIAutomator
  143. [debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554"
  144. ,"shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.b
  145. ootstrap.Bootstrap","-e","pkg","com.android.calculator2","-e","disableAndroidWat
  146. chers",false,"-e","acceptSslCerts",false]
  147. [UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
  148. [debug] [UiAutomator] Moving to state 'stopped'

求教,这一直停止不动是为何?AVD也没有任何反应?

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/335659
推荐阅读
相关标签
  

闽ICP备14008679号