gpt4 book ai didi

AndroidViewClient 和系统设置应用

转载 作者:太空宇宙 更新时间:2023-11-03 12:57:43 28 4
gpt4 key购买 nike

所以我正在尝试自动执行“安全”>“屏幕锁定”>“无”选项,但我似乎在让 AndroidViewClient“选择”屏幕锁定选项时遇到了一些麻烦,该选项会将您带到下一个菜单以选择您的屏幕.这是代码:

device, serialno = ViewClient.connectToDeviceOrExit(serialno=devices[input])
print("Modifying settings...")
device.startActivity(settings_uri)
vc = ViewClient(device, serialno)

# Disable screen lock
vc.findViewWithTextOrRaise("Security").getParent().getParent().touch()
MonkeyRunner.sleep(3)
vc.findViewWithTextOrRaise(re.compile('Screen lock')).touch()

导致以下异常:

130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "/home/allen/projects/cts-scripts/4.2/cts-setup.py", line 585, in <module>
main()
File "/home/allen/projects/cts-scripts/4.2/cts-setup.py", line 550, in main
vc.findViewWithTextOrRaise(re.compile('Screen lock')).touch()
File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 2052, in findViewWithTextOrRaise
raise ViewNotFoundException("text", text, root)
com.dtmilano.android.viewclient.ViewNotFoundException: Couldn't find View with text that matches 'Screen lock' in tree with root=ROOT

130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyException.fillInStackTrace(PyException.java:70)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at java.lang.Throwable.<init>(Throwable.java:181)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at java.lang.Exception.<init>(Exception.java:29)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at java.lang.RuntimeException.<init>(RuntimeException.java:32)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyException.<init>(PyException.java:46)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyException.doRaise(PyException.java:219)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1239)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1243)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1247)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.findViewWithTextOrRaise$97(/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py:2052)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.call_function(/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:141)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.__call__(PyFunction.java:327)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyMethod.__call__(PyMethod.java:124)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.main$48(/home/allen/projects/cts-scripts/4.2/cts-setup.py:550)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.call_function(/home/allen/projects/cts-scripts/4.2/cts-setup.py)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.__call__(PyFunction.java:307)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.f$0(/home/allen/projects/cts-scripts/4.2/cts-setup.py:585)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.call_function(/home/allen/projects/cts-scripts/4.2/cts-setup.py)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyCode.call(PyCode.java:18)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.runCode(Py.java:1275)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.execfile_flags(__builtin__.java:522)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
130614 18:09:43.547:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)

关于问题是什么有什么想法吗?

最佳答案

我想出了问题所在。每次屏幕上的内容发生变化时,您都必须调用 vc.dump()。

关于AndroidViewClient 和系统设置应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17119365/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com