android - AndroidViewClient:如何知道我们将屏幕完全拖到最后
问题描述
我想使用 ID 向所有朋友发送消息,我的屏幕一次只显示 12 个 ID。在这里,我正在收集列表中的所有 ID 并向所有 12 个 ID 发送消息,现在我清除了 ID 列表并拖动屏幕。现在拿起新的身份证。所以,我想知道我已经完全拖动屏幕直到我可以终止外循环。
name = list(vc.findViewsWithAttribute('class','javaClass'))
while True:
for i in range(len(name)):
try:
vc.dump()
name[i].touch()
vc.dump()
vc.findViewWithText('Chat').touch()
new_message = message
vc.dump()
message_field = vc.findViewByIdOrRaise("com.snapchat.android:id/chat_input_text_field")
message_field.setText(new_message)
time.sleep(1)
vc.dump()
d.press("input keyevent KEYCODE_ENTER")
vc.dump()
vc.findViewByIdOrRaise("com.snapchat.android:id/back_button").touch()
except:pass
try:
name.clear()
device.drag((200, 500), (200,180), 68, 20, 0)
name = list(vc.findViewsWithAttribute('class','javaClass'))
except: pass
我想更改while True:条件,因为它是一个无限循环。
解决方案
我认为这样的事情应该有效
last_name = None
name = list(vc.findViewsWithAttribute('class','javaClass'))
while last_name != name[-1]:
for i in range(len(name)):
try:
vc.dump()
name[i].touch()
vc.dump()
vc.findViewWithText('Chat').touch()
new_message = message
vc.dump()
message_field = vc.findViewByIdOrRaise("com.snapchat.android:id/chat_input_text_field")
message_field.setText(new_message)
time.sleep(1)
vc.dump()
d.press("input keyevent KEYCODE_ENTER")
vc.dump()
vc.findViewByIdOrRaise("com.snapchat.android:id/back_button").touch()
except:pass
try:
name.clear()
device.drag((200, 500), (200,180), 68, 20, 0)
last_name = name[-1]
name = list(vc.findViewsWithAttribute('class','javaClass'))
except: pass
推荐阅读
- docker - Docker 容器正在运行但找不到它们
- javascript - 当函数工作时,else语句是执行的语句
- pyspark - 如何将pyspark数据框保存在单个csv文件中
- javascript - 为什么我的 nodeValue 属性不起作用?
- python - 哪个更快:添加键值对或检查键是否存在?
- mysql - 我怎样才能提出这个 sql join 请求
- php - Twilio Studio 和 Rebrandly 链接缩短器 - 返回解析而不是字符串
- solidity - 当我尝试在 vscode 中导入 Openzeppelin 合同时出现 ParserError
- python - Python boto3 (AWS EC2) 列出嵌套 JSON 数据
- excel - Excel匹配多个标准不起作用