我写了一段代码在accessibilityservice中点击一个按钮,它在其他按钮上工作得很好,但是这个按钮很棘手,它强制用户等待3秒才能点击它我不能在accessibilityservice中点击它,即使我等待3秒它仍然没有点击这里是我的代码
if (event.getSource() != null) {
if (event.getPackageName().equals("com.mrsool")) {
AccessibilityNodeInfo nodeInfo = event.getSource();
if (nodeInfo == null) {
return;
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
// We can find button using button name or button id
List<AccessibilityNodeInfo> list = nodeInfo
.findAccessibilityNodeInfosByViewId("com.mrsool:id/fllwillDeliver");
for (AccessibilityNodeInfo node : list) {
node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
list = nodeInfo.findAccessibilityNodeInfosByViewId("com.mrsool:id/fllwillDeliver");
for (AccessibilityNodeInfo node : list) {
node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
}
}
}发布于 2020-08-09 17:02:52
我通过改变解决了这个问题
findAccessibilityNodeInfosByViewId 至
findAccessibilityNodeInfosByTexthttps://stackoverflow.com/questions/63319814
复制相似问题