AirtestProject / AirtestProject/Poco

pocoui相关 小程序UI脚本运行时有时候会定位不到元素报超时,有时间又没问题,已添加了等待时间方式了,排除页面加载时间问题。可看具体描述,多谢。

Đang mở
#471 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2k
Fork
341
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

运行环境:
macos10.14.6,python 3.9 , airtest 1.2.0 ,pocoui 1.0.82,手机华为mote10,手机系统android10,Android Debug Bridge version 1.0.41 Version 29.0.6-6198805,微信小程序:"超级猩猩"
"
问题描述:
在运行脚本时微信切入小程序页面后,定位不到小程序页面元素,报了超时错误。但是该场景问题偶尔会成功,有时间就可以定位到,不会报错。经过确认不是页面加载太快或太慢的原因,因为已经加了等待。同时手机对pocoservice已经开启启动权限。

代码截图:
![image](https://user-images.githubusercontent.com/52486139/123899022-fabed980-d998-11eb-9eb8-7f9921933f74.png)
![image](https://user-images.githubusercontent.com/52486139/123899034-027e7e00-d999-11eb-83d6-c428b0417030.png)

报错信息:
报错:
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 wait-for-device
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell getprop ro.build.version.sdk
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys activity top
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys package com.netease.open.pocoservice
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys package com.netease.open.pocoservice.test
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 forward --no-rebind tcp:17413 tcp:10080
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 forward --no-rebind tcp:12023 tcp:10081
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell ps -A |echo $(grep -E com.github.uiautomator)
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell am force-stop com.netease.open.pocoservice
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell am start -n com.netease.open.pocoservice/.TestActivity
[11:04:20][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell am instrument -w -e debug false -e class com.netease.open.pocoservice.InstrumentedTestAsLauncher com.netease.open.pocoservice.test/android.support.test.runner.AndroidJUnitRunner
[11:04:22][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell monkey -p com.tencent.mm -c android.intent.category.LAUNCHER 1
[11:04:29][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell ls -l /data/local/tmp/rotationwatcher.jar
[11:04:29][DEBUG] install_rotationwatcher skipped
[11:04:29][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell app_process -Djava.class.path=/data/local/tmp/rotationwatcher.jar /data/local/tmp com.example.rotationwatcher.Main
[11:04:29][DEBUG] [rotation_server]b'0'
[11:04:31][INFO] update orientation None->0
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys display
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys SurfaceFlinger
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell getevent -p
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell ls -l /data/local/tmp/maxpresent.jar
[11:04:31][DEBUG] install_maxtouch skipped
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys display
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell dumpsys SurfaceFlinger
[11:04:31][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell getevent -p
[11:04:32][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 forward --no-rebind tcp:12512 localabstract:maxpresent_12512
[11:04:32][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell app_process -Djava.class.path=/data/local/tmp/maxpresent.jar /data/local/tmp com.netease.maxpresent.MaxPresent socket maxpresent_12512
[11:04:32][DEBUG] [airtouch_server]b'Metrics Message : 2560.0=====1440.0'
[11:04:32][DEBUG] [airtouch_server]b'Start local socket (maxpresent_12512) server...'
[11:06:50][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 shell am force-stop com.tencent.mm

Error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
yield
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py", line 593, in run
self._callTestMethod(testMethod)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
method()
File "/Users/supermonkey/AirtestProject/demo.py", line 125, in test_case
self.assertEqual(HomePage().select_good_lessons_get_text(poco=self.poco),"精选好课")
File "/Users/supermonkey/AirtestProject/demo.py", line 88, in select_good_lessons_get_text
init_element(self.select_good_lessons,poco).wait_for_appearance()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/poco/proxy.py", line 681, in wait_for_appearance
raise PocoTargetTimeout('appearance', self)
poco.exceptions.PocoTargetTimeout: Waiting timeout for appearance of "UIObjectProxy of "text=精选好课""

Assertion failed
只执行一次

Ran 1 test in 150.926s

FAILED (errors=1)
[11:06:51][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 forward --remove tcp:17413
[11:06:51][DEBUG] /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/airtest/core/android/static/adb/mac/adb -P 5037 -s UYT5T18524015578 forward --remove tcp:12512
[11:06:51][DEBUG] [rotation_server]b''
[11:06:51][DEBUG] [airtouch_server]b''

Process finished with exit code 1

Assertion failed

Assertion failed

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.