gpt4 book ai didi

java - Android:如何以编程方式检测 Android 设备中的谷歌登录弹出窗口

转载 作者:行者123 更新时间:2023-11-29 21:15:39 26 4
gpt4 key购买 nike

enter image description here

我试过以下 monkeyrunner 脚本:

#!/usr/bin/env monkeyrunner 
from __future__ import with_statement
import logging
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from com.android.monkeyrunner.easy import EasyMonkeyDevice

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

if __name__ == '__main__':
udid = '02f4e07008e40dfc' #sys.argv[1]
device = MonkeyRunner.waitForConnection(60, udid)
easyDevice = EasyMonkeyDevice(device)
logger.info(easyDevice.getFocusedWindowId())
#h = device.getHierarchyViewer()
#w = h.getFocusedWindowName()
#logger.info(w)

但我得到:

File "./detectGoogleLoginPopup.py", line 19, in <module>
easyDevice = EasyMonkeyDevice(device)
java.lang.RuntimeException: Could not connect to the view server

我现在有一个 ocr 方法来解决这个问题,但我会喜欢基于 monkeyrunner 或 java api 的解决方案。

最佳答案

使用 AndroidViewClient/culebra 您可以轻松检测包含文本 You typed an incorrect password... 的 View 是否在聚焦窗口中(即使使用正则表达式):

vc.findViewWithText('You typed an incorrect password.*')

我认为这会解决您的问题。

关于java - Android:如何以编程方式检测 Android 设备中的谷歌登录弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21515914/

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