哈哈哈哈哈 老夫查了好多都沒好用的 靈機一動 簡簡單單找到了那個節(jié)點 他最惡心的是有的節(jié)點文字你是獲取不到的 然后我也不知道哪個方法能返回回來 搞了好多個一起打印 總算讓老子找到了 記錄下來 以后繼續(xù)用
/**
* 用于遞歸查找h5節(jié)點的
* @param nodeInfo 這個就是查節(jié)點的第一個入口了 建議越外層越好
* @param path 這個是用來畫路徑的 剩的你找到了對象 找不到他的位置
*/
private void searchClickableView(AccessibilityNodeInfo nodeInfo, String path) {
if (nodeInfo != null) {
for (int i = 0; i < nodeInfo.getChildCount(); i++) {
String pathStr = path + "," + i;
AccessibilityNodeInfo child = nodeInfo.getChild(i);
if (child == null) continue;
if (child.isClickable()) {
performViewClick(child);
LogUtil.show("getViewIdResourceName:" + child.getViewIdResourceName()
+ ",getContentDescription:" + child.getContentDescription()
+ ",getClassName:" + child.getClassName()
+ ",getText:" + child.getText()
+ ",path:" + pathStr
);
continue;
}
if (child.getChildCount() > 0) {
searchClickableView(child, pathStr);
}
}
}
LogUtil.show("path:" + path);
}