51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 961|回复: 2
打印 上一主题 下一主题

[原创] Day5-6测试积点任务

[复制链接]
  • TA的每日心情
    无聊
    昨天 09:21
  • 签到天数: 409 天

    连续签到: 3 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2018-8-16 11:27:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    问题:
    按钮"allow"似乎没有被按

    比较初级的问题,但是折腾了好久,就是找不到原因。
    希望有经验的前辈能帮忙看看有没有问题,如果有,出在哪里?
    多谢多谢,不胜感激!

    appium 1.4.16.1
    windows10-64 bits
    python2.7
    phone huawei honor6-4.4.2

    希望appium能够实现按钮点击“allow”

    我的脚本代码:

    1. <font color="rgb(34,37,39)"><font face="Helvetica, Arial,">sleep(6)
    2. self.driver.find_element_by_xpath("//android.widget.Button[@text='Allow']").click</font></font>
    复制代码
    我的appium日志:



    1. info: --> POST /wd/hub/session {"requiredCapabilities":{},"desiredCapabilities":{"platformVersion":"4.4.2","deviceName":"022SSE146M005259","platformName":"Android","appActivity":"com.jabra.sport.core.ui.SplashActivity","appPackage":"com.jabra.sport"}}
    2. info: Client User-Agent string: Python-urllib/2.7
    3. info: [debug] Using local app from command line: C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk
    4. info: [debug] Creating new appium session d05bd16a-4be4-4377-9f7f-be5c0734106f
    5. info: Starting android appium
    6. info: [debug] Getting Java version
    7. info: Java version is: 1.8.0_121
    8. info: [debug] Checking whether adb is present
    9. info: [debug] Using adb from C:\AndroidSDK\platform-tools\adb.exe
    10. info: [debug] Using fast reset? true
    11. info: [debug] Preparing device for session
    12. info: [debug] Checking whether app is actually present
    13. info: Retrieving device
    14. info: [debug] Trying to find a connected android device
    15. info: [debug] Getting connected devices...
    16. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe devices
    17. info: [debug] 1 device(s) connected
    18. info: Found device 022SSE146M005259
    19. info: [debug] Setting device id to 022SSE146M005259
    20. info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
    21. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 wait-for-device
    22. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "echo 'ready'"
    23. info: [debug] Starting logcat capture
    24. info: [debug] Getting device API level
    25. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "getprop ro.build.version.sdk"
    26. info: [debug] Device is at API Level 19
    27. info: Device API level is: 19
    28. info: [debug] Extracting strings for language: default
    29. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "getprop persist.sys.language"
    30. info: [debug] Current device persist.sys.language: en
    31. info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk" "C:\Users\speng\AppData\Local\Temp\com.jabra.sport" en
    32. info: [debug] No strings.xml for language 'en', getting default strings.xml
    33. info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk" "C:\Users\speng\AppData\Local\Temp\com.jabra.sport"
    34. info: [debug] Reading strings from converted strings.json
    35. info: [debug] Setting language to default
    36. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 push "C:\Users\speng\AppData\Local\Temp\com.jabra.sport\strings.json" /data/local/tmp
    37. info: [debug] Checking whether aapt is present
    38. info: [debug] Using aapt from C:\AndroidSDK\build-tools\25.0.1\aapt.exe
    39. info: [debug] Retrieving process from manifest.
    40. info: [debug] executing cmd: C:\AndroidSDK\build-tools\25.0.1\aapt.exe dump xmltree C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk AndroidManifest.xml
    41. info: [debug] Set app process to: com.jabra.sport
    42. info: [debug] Not uninstalling app since server not started with --full-reset
    43. info: [debug] Checking app cert for C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk.
    44. info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk
    45. info: [debug] App already signed.
    46. info: [debug] Zip-aligning C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk
    47. info: [debug] Checking whether zipalign is present
    48. info: [debug] Using zipalign from C:\AndroidSDK\build-tools\25.0.1\zipalign.exe
    49. info: [debug] Zip-aligning apk.
    50. info: [debug] executing cmd: C:\AndroidSDK\build-tools\25.0.1\zipalign.exe -f 4 C:\MyDownloads\JabraSportLife-3_1_2-SNAPSHOT-3010200-debug.apk C:\Users\speng\AppData\Local\Temp\117224-12628-1byysyk\appium.tmp
    51. info: [debug] MD5 for app is 269a8b7d81c774571d30184c9af7dc92
    52. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "ls /data/local/tmp/269a8b7d81c774571d30184c9af7dc92.apk"
    53. info: [debug] Getting install status for com.jabra.sport
    54. info: [debug] Getting device API level
    55. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "getprop ro.build.version.sdk"
    56. info: [debug] Device is at API Level 19
    57. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "pm list packages -3 com.jabra.sport"
    58. info: [debug] App is installed
    59. info: App is already installed, resetting app
    60. info: [debug] Running fast reset (stop and clear)
    61. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "am force-stop com.jabra.sport"
    62. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "pm clear com.jabra.sport"
    63. info: [debug] Forwarding system:4724 to device:4724
    64. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 forward tcp:4724 tcp:4724
    65. info: [debug] Pushing appium bootstrap to device...
    66. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
    67. info: [debug] Pushing settings apk to device...
    68. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
    69. info: [debug] Pushing unlock helper app to device...
    70. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
    71. info: Starting App
    72. info: [debug] Attempting to kill all 'uiautomator' processes
    73. info: [debug] Getting all processes with 'uiautomator'
    74. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "ps 'uiautomator'"
    75. info: [debug] No matching processes found
    76. info: [debug] Running bootstrap
    77. info: [debug] spawning: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.jabra.sport -e disableAndroidWatchers false
    78. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
    79. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
    80. info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
    81. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
    82. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
    83. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
    84. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
    85. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
    86. info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
    87. info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
    88. info: [debug] [BOOTSTRAP] [debug] Loading json...
    89. info: [debug] Waking up device if it's not alive
    90. info: [debug] Pushing command to appium work queue: ["wake",{}]
    91. info: [debug] [BOOTSTRAP] [debug] json loading complete.
    92. info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
    93. info: [debug] [BOOTSTRAP] [debug] Client connected
    94. info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
    95. info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    96. info: [debug] [BOOTSTRAP] [debug] Got command action: wake
    97. info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
    98. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "dumpsys window"
    99. info: [debug] Screen already unlocked, continuing.
    100. info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
    101. info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
    102. info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    103. info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
    104. info: [debug] dataDir set to: /data/local/tmp
    105. info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
    106. info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data\/local\/tmp","status":0}
    107. info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
    108. info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    109. info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
    110. info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
    111. info: [debug] Getting device API level
    112. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "getprop ro.build.version.sdk"
    113. info: [debug] Device is at API Level 19
    114. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.jabra.sport/com.jabra.sport.core.ui.SplashActivity"
    115. info: [debug] Waiting for pkg "com.jabra.sport" and activity "com.jabra.sport.core.ui.SplashActivity" to be focused
    116. info: [debug] Getting focused package and activity
    117. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "dumpsys window windows"
    118. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "getprop ro.build.version.release"
    119. info: [debug] Device is at release version 4.4.2
    120. info: [debug] Device launched! Ready for commands
    121. info: [debug] Setting command timeout to the default of 60 secs
    122. info: [debug] Appium session started with sessionId d05bd16a-4be4-4377-9f7f-be5c0734106f
    123. info: <-- POST /wd/hub/session 303 14306.346 ms - 74
    124. info: --> GET /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f {}
    125. info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.4.2","deviceName":"022SSE146M005259","platformName":"Android","appActivity":"com.jabra.sport.core.ui.SplashActivity","appPackage":"com.jabra.sport"},"deviceName":"022SSE146M005259","platformName":"Android","appActivity":"com.jabra.sport.core.ui.SplashActivity","appPackage":"com.jabra.sport"},"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    126. info: <-- GET /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f 200 2.344 ms - 641 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.4.2","deviceName":"022SSE146M005259","platformName":"Android","appActivity":"com.jabra.sport.core.ui.SplashActivity","appPackage":"com.jabra.sport"},"deviceName":"022SSE146M005259","platformName":"Android","appActivity":"com.jabra.sport.core.ui.SplashActivity","appPackage":"com.jabra.sport"},"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    127. info: --> POST /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f/element {"using":"xpath","sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f","value":"//android.widget.Button[@text='Allow']"}
    128. info: [debug] Waiting up to 0ms for condition
    129. info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.Button[@text='Allow']","context":"","multiple":false}]
    130. info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.Button[@text='Allow']","context":"","multiple":false}}
    131. info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
    132. info: [debug] [BOOTSTRAP] [debug] Got command action: find
    133. info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.Button[@text='Allow'] using XPATH with the contextId: multiple: false
    134. info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.Button, INSTANCE=1]
    135. info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"1"},"status":0}
    136. info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    137. info: <-- POST /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f/element 200 247.680 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    138. info: --> DELETE /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f {}
    139. info: Shutting down appium session
    140. info: [debug] Pressing the HOME button
    141. info: [debug] executing cmd: C:\AndroidSDK\platform-tools\adb.exe -s 022SSE146M005259 shell "input keyevent 3"
    142. info: [debug] Stopping logcat capture
    143. info: [debug] Logcat terminated with code null, signal SIGTERM
    144. info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
    145. info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
    146. info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}
    147. info: [debug] [BOOTSTRAP] [debug] Closed client connection
    148. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
    149. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
    150. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
    151. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
    152. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
    153. info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
    154. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
    155. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
    156. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
    157. info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
    158. info: [debug] [UIAUTOMATOR STDOUT] Time: 8.791
    159. info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
    160. info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
    161. info: [debug] UiAutomator shut down normally
    162. info: [debug] Cleaning up android objects
    163. info: [debug] Cleaning up appium session
    164. info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    165. info: <-- DELETE /wd/hub/session/d05bd16a-4be4-4377-9f7f-be5c0734106f 200 705.449 ms - 76 {"status":0,"value":null,"sessionId":"d05bd16a-4be4-4377-9f7f-be5c0734106f"}
    复制代码
    答案:
    游客,如果您要查看本帖隐藏内容请回复


    附件: 您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    昨天 10:14
  • 签到天数: 1392 天

    连续签到: 3 天

    [LV.10]测试总司令

    2#
    发表于 2018-8-17 10:46:01 | 只看该作者
    先确认是否知道了按钮,再查看是否点击
    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    昨天 07:14
  • 签到天数: 2666 天

    连续签到: 3 天

    [LV.Master]测试大本营

    3#
    发表于 2018-8-17 10:57:58 | 只看该作者
    先查看下是否定位到了
    回复

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-5-9 04:27 , Processed in 0.066723 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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