This commit is contained in:
2021-10-29 10:21:37 +08:00
parent 297bf96660
commit e3bc01ec64
5 changed files with 161 additions and 366 deletions

View File

@@ -471,13 +471,13 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
AccessibilityNodeInfo child4 = child3.getChild(r); AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription()); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription());
nodeZuobiao(child4); nodeZuobiao(child4);
for (int m = 0; m < child4.getChildCount(); m++) { // for (int m = 0; m < child4.getChildCount(); m++) {
AccessibilityNodeInfo child5 = child4.getChild(m); // AccessibilityNodeInfo child5 = child4.getChild(m);
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription()); // Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription());
nodeZuobiao(child5); // nodeZuobiao(child5);
for (int p = 0; p < child5.getChildCount();p++) { // for (int p = 0; p < child5.getChildCount();p++) {
AccessibilityNodeInfo child6 = child5.getChild(p); // AccessibilityNodeInfo child6 = child5.getChild(p);
Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription()); // Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription());
// for (int t = 0; t < child6.getChildCount();t++) { // for (int t = 0; t < child6.getChildCount();t++) {
// AccessibilityNodeInfo child7 = child6.getChild(t); // AccessibilityNodeInfo child7 = child6.getChild(t);
// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription()); // Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription());
@@ -487,8 +487,8 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
// //
// } // }
// } // }
} // }
} // }
} }
} }
} }

View File

@@ -1,33 +1,15 @@
package com.fisherbone.fuzhu.step; package com.fisherbone.fuzhu.step;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.GestureDescription;
import android.annotation.TargetApi;
import android.graphics.Path;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Build;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.Nullable;
import com.blankj.utilcode.util.ScreenUtils;
import com.fisherbone.fuzhu.ChangLiang;
import com.fisherbone.fuzhu.abllib.AblService; import com.fisherbone.fuzhu.abllib.AblService;
import com.fisherbone.fuzhu.abllib.AblStepHandler; import com.fisherbone.fuzhu.abllib.AblStepHandler;
import com.fisherbone.fuzhu.abllib.AblSteps; import com.fisherbone.fuzhu.abllib.AblSteps;
import com.fisherbone.fuzhu.abllib.BaseAblStep; import com.fisherbone.fuzhu.abllib.BaseAblStep;
import com.fisherbone.fuzhu.abllib.RandumInt;
import com.fisherbone.fuzhu.abllib.callback.GestureCallBack;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.entity.LiwuBean;
import com.fisherbone.fuzhu.utils.ProfileSpUtils;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/** /**
* 获得作品时间 * 获得作品时间
@@ -47,167 +29,21 @@ public class TestAblStep0 extends BaseAblStep {
break; break;
case AblSteps.STEP_2: case AblSteps.STEP_2:
AblViewUtil.mySleep(5); AblViewUtil.mySleep(5);
// getNodeInfoh(); // getNodeInfoh();
// cancelGuanzhu(AblService.getInstance()); // getNodeInfoy();
getNodeInfohg();
//(0,562),(1080,774)
// isContainText("关注");
boolean nodeInfoh = ifGaunzhu();
if(nodeInfoh){
Log.e("TIAOSHI###", "此视频没有关注过");
}else {
Log.e("TIAOSHI###", "此视频已关注");
return;
}
break;
default: default:
} }
} }
/**
* 直播间点赞
*100-300
* @param mun
*/
public void zhibodianzanc(int mun) {
// for (int i = 0; i < mun; i++) {
// int a = 640 + RandumInt.getRandumInt4() * 30;
// int b = 490;
// int c = 200 - RandumInt.getRandumInt4() * 20;
// AblService.getInstance().clickPoint(a, b, 100);
// try {
// //隔200 ms
// Thread.sleep(c);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
Random r = new Random();
for (int i = 0; i < 10; i++) {
//r.nextInt(n) n为几 就产生0~n-1的随机数
int num = r.nextInt(2)+1;
// System.out.print(num+"\t");
Log.e("TIAOSHI###", num+"");
}
}
/**
* 发送节点
* @return
*/
public AccessibilityNodeInfo geouyintdd() {
AccessibilityNodeInfo nodeinfo = null;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
if ("android.widget.ImageView".equals(child.getClassName())) {
if(child.getContentDescription()!=null) {
if (child.getContentDescription().toString().equals("发送")) {
nodeinfo = child;
}
}
}
}
return nodeinfo;
}
/**
* 输入框
* @return
*/
public AccessibilityNodeInfo getedittext() {
AccessibilityNodeInfo nodeinfo = null;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
if ("android.widget.EditText".equals(child.getClassName())) {
nodeinfo=child;
}
}
return nodeinfo;
}
/**
* 判断当前页面是否包含某文本
*/
public AccessibilityNodeInfo isContainText(String str) {
AccessibilityNodeInfo nodeInfo = null;
List<AccessibilityNodeInfo> nodeInfos = AblViewUtil.findByText(str);
for (int i=0;i<nodeInfos.size();i++){
AccessibilityNodeInfo child = nodeInfos.get(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
Rect rect = new Rect();
child.getBoundsInScreen(rect);
if(rect.left>0&&rect.top>2000&&rect.top<=2210&&rect.bottom>0&&rect.bottom<=2210&&rect.right<1080) {
Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child);
nodeInfo = child;
}
}
return nodeInfo;
}
/** /**
* 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) * 寻找控件
* 1.说点什么
* 2.更多
* 3.礼物
*/ */
public void clickmoreli(String type) { public void getNodeInfohg() {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j);
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
for (int x = 0; x < child2.getChildCount(); x++) {
AccessibilityNodeInfo child3 = child2.getChild(x);
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
switch (type) {
case "1"://说点什么
if ("android.widget.TextView".equals(child4.getClassName())) {
if (child4.getText() != null) {
if (child4.getText().toString().equals("说点什么...")) {
AblService.getInstance().clickcommontwo(child4, "");
}
}
}
break;
case "2"://更多
if ("android.widget.Button".equals(child4.getClassName())) {
if (child4.getContentDescription().equals("更多")) {
AblService.getInstance().clickcommontwo(child4, "点击了更多");
}
}
break;
case "3"://礼物
if ("android.widget.Button".equals(child4.getClassName())) {
if (child4.getContentDescription().equals("礼物")) {
AblService.getInstance().clickcommontwo(child4, "");
}
}
break;
default:
}
}
}
}
}
}
}
private void cancelGuanzhu(AblService instance) {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) { for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i); AccessibilityNodeInfo child = root.getChild(i);
@@ -217,115 +53,47 @@ public class TestAblStep0 extends BaseAblStep {
AccessibilityNodeInfo child1 = child.getChild(y); AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
// nodeZuobiao(child1); // nodeZuobiao(child1);
for (int j = 0; j < child1.getChildCount(); j++) { for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j); AccessibilityNodeInfo child2 = child1.getChild(j);
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); if ("androidx.recyclerview.widget.RecyclerView".equals(child2.getClassName())) {
// nodeZuobiao(child2); // if (j == child1.getChildCount() - 1) {
for (int x = 0; x < child2.getChildCount(); x++) { Rect rect = new Rect();
AccessibilityNodeInfo child3 = child2.getChild(x); child2.getBoundsInScreen(rect);
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); if (rect.right > 0) {
// nodeZuobiao(child3); // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if("android.widget.RelativeLayout".equals(child3.getClassName())) { // nodeZuobiao(child2);
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r); for (int x = 0; x < child2.getChildCount(); x++) {
if("android.widget.FrameLayout".equals(child4.getClassName())) { AccessibilityNodeInfo child3 = child2.getChild(x);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription()); // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
for (int m = 0; m < child4.getChildCount(); m++) { // nodeZuobiao(child3);
AccessibilityNodeInfo child5 = child4.getChild(m);
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); if ("android.widget.FrameLayout".equals(child3.getClassName())) {
for (int p = 0; p < child5.getChildCount(); p++) { if (x == 0) {
AccessibilityNodeInfo child6 = child5.getChild(p); for (int r = 0; r < child3.getChildCount(); r++) {
Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); AccessibilityNodeInfo child4 = child3.getChild(r);
// nodeZuobiao(child5); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// yiguanzhu(child5); nodeZuobiao(child4);
for (int m = 0; m < child4.getChildCount(); m++) {
AccessibilityNodeInfo child5 = child4.getChild(m);
if ("com.lynx.tasm.behavior.ui.view.UIView".equals(child5.getClassName())) {
if ("关注".equals(child5.getContentDescription())) {
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
nodeZuobiao(child5);
clickcommontwo(child5, "");
}
}
}
} }
} }
} }
} }
}
}
}
}
}
}
// 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhu(AccessibilityNodeInfo child2) {
boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed();
boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor();
if (cancelclosed&&!cancelcrosscor) {
Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ");
if (child2.getChildCount() != 0) {
for (int i = 0; i < child2.getChildCount(); i++) {
AccessibilityNodeInfo child = child2.getChild(i);
if (child.getText() != null) {
if (!child.getText().toString().equals("已关注")) {
continue;
}
}
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (child.getText() != null) {
if (child.getText().toString().equals("已关注")) {
clickcommontwo(child, "已关注");
}
}
}
}
}
if (cancelcrosscor&&!cancelclosed) {
Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV");
if (child2.getChildCount() != 0) {
for (int w = 0; w < child2.getChildCount(); w++) {
AccessibilityNodeInfo childw = child2.getChild(w);
if (childw != null) {
if (childw.getText() != null) {
if (!childw.getText().toString().equals("互相关注")) {
continue;
}
}
AblViewUtil.mySleep(1);
if (childw.getText() != null) {
if (childw.getText().toString().equals("互相关注")) {
clickcommontwo(childw, "互相关注");
AblViewUtil.mySleep(2);
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
clickcommontwo(quxiao, "取消关注");
}
}
}
}
}
}
if(cancelclosed&&cancelcrosscor){
Log.e("TIAOSHI###", "WWWWWWWWWWWWWWWWWWWWW");
if (child2.getChildCount() != 0) {
for (int i = 0; i < child2.getChildCount(); i++) {
AccessibilityNodeInfo child = child2.getChild(i);
if (child.getText() != null) {
if (child.getText().toString().equals("已关注")) {
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
clickcommontwo(child, "已关注");
}
if (child.getText().toString().equals("互相关注")) {
AblViewUtil.mySleep(1);
clickcommontwo(child, "互相关注");
AblViewUtil.mySleep(2);
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
clickcommontwo(quxiao, "取消关注");
AblViewUtil.mySleep(1);
} }
} }
@@ -335,36 +103,53 @@ public class TestAblStep0 extends BaseAblStep {
} }
/** /**
* 是否关注过 判断的准确率在百分之90之上 * 寻找控件
*/ */
public boolean ifGaunzhu() { public void getNodeInfoy() {
boolean flag = false;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) { for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i); AccessibilityNodeInfo child = root.getChild(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) { nodeZuobiao(child);
// Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); for (int y = 0; y < child.getChildCount(); y++) {
// nodeZuobiao(child); AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
for (int y = 0; y < child.getChildCount(); y++) { nodeZuobiao(child1);
AccessibilityNodeInfo child1 = child.getChild(y); // AccessibilityNodeInfo child2 = child1.getChild(child1.getChildCount());
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
// nodeZuobiao(child1); if (y == child.getChildCount() - 1) {
// Log.e("TIAOSHI###", "----threeNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
nodeZuobiao(child1);
for (int j = 0; j < child1.getChildCount(); j++) { for (int j = 0; j < child1.getChildCount(); j++) {
AccessibilityNodeInfo child2 = child1.getChild(j); AccessibilityNodeInfo child2 = child1.getChild(j);
Rect rect = new Rect(); Log.e("TIAOSHI###", "----fourNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
child2.getBoundsInScreen(rect); if ("android.widget.FrameLayout".equals(child2.getClassName())) {
if (rect.left > 0 && rect.left <= 1080 && rect.top > 0 && rect.top <= 2210 && rect.bottom > 0 && rect.bottom <= 2210 && rect.right <= 1080) { if (j == 0) {
for (int x = 0; x < child2.getChildCount(); x++) {
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); AccessibilityNodeInfo child3 = child2.getChild(x);
nodeZuobiao(child2); Log.e("TIAOSHI###", "----fiveNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
if ("android.widget.Button".equals(child2.getClassName())) { for (int h = 0; h < child3.getChildCount(); h++) {
if (child2.getContentDescription() != null) { AccessibilityNodeInfo child4 = child3.getChild(h);
Log.e("TIAOSHI###", "----sixNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
if ("关注".equals(child2.getContentDescription().toString())) { int childCount = child4.getChildCount();
flag = true; Log.e("TIAOSHI###", "----sixNode数量:" + childCount);
nodeZuobiao(child4);
for (int m = 0; m < child4.getChildCount(); m++) {
AccessibilityNodeInfo child5 = child4.getChild(m);
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
nodeZuobiao(child5);
for (int p = 0; p < child5.getChildCount(); p++) {
if (p == 0) {
continue;
}
AccessibilityNodeInfo child6 = child5.getChild(p);
Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription());
nodeZuobiao(child6);
if ("关注".equals(child6.getContentDescription())) {
clickcommontwo(child6, "");
}
}
}
} }
} }
} }
@@ -373,9 +158,10 @@ public class TestAblStep0 extends BaseAblStep {
} }
} }
} }
return flag;
} }
} }

View File

@@ -1,5 +1,6 @@
package com.fisherbone.fuzhu.step; package com.fisherbone.fuzhu.step;
import android.graphics.Rect;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
@@ -31,12 +32,12 @@ public class TestAblStep32 extends NoticeBase {
AblViewUtil.mySleep(5); AblViewUtil.mySleep(5);
AppoBean appoBean = ProfileSpUtils.getInstance().getAppoBean(); AppoBean appoBean = ProfileSpUtils.getInstance().getAppoBean();
this.objects = appoBean.getData(); this.objects = appoBean.getData();
Log.e("TIAOSHI###", "1234" ); Log.e("TIAOSHI###", "1234");
AblStepHandler.sendMsg(AblSteps.STEP_232); AblStepHandler.sendMsg(AblSteps.STEP_232);
break; break;
case AblSteps.STEP_232: case AblSteps.STEP_232:
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
Log.e("TIAOSHI###", "56778" ); Log.e("TIAOSHI###", "56778");
if (this.objects.size() == 0) { if (this.objects.size() == 0) {
AblViewUtil.potgegin("停止"); AblViewUtil.potgegin("停止");
return; return;
@@ -94,74 +95,60 @@ public class TestAblStep32 extends NoticeBase {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) { for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i); AccessibilityNodeInfo child = root.getChild(i);
Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription()); // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
nodeZuobiao(child); // nodeZuobiao(child);
for (int y = 0; y < child.getChildCount(); y++) { for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y); AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
nodeZuobiao(child1); // nodeZuobiao(child1);
// AccessibilityNodeInfo child2 = child1.getChild(child1.getChildCount());
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); for (int j = 0; j < child1.getChildCount(); j++) {
if (y == child.getChildCount() - 1) { AccessibilityNodeInfo child2 = child1.getChild(j);
// Log.e("TIAOSHI###", "----threeNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription()); if ("androidx.recyclerview.widget.RecyclerView".equals(child2.getClassName())) {
nodeZuobiao(child1); // if (j == child1.getChildCount() - 1) {
for (int j = 0; j < child1.getChildCount(); j++) { Rect rect = new Rect();
AccessibilityNodeInfo child2 = child1.getChild(j); child2.getBoundsInScreen(rect);
Log.e("TIAOSHI###", "----fourNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); if (rect.right > 0) {
if ("android.widget.FrameLayout".equals(child2.getClassName())) { // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if (j == 0) { // nodeZuobiao(child2);
for (int x = 0; x < child2.getChildCount(); x++) {
AccessibilityNodeInfo child3 = child2.getChild(x); for (int x = 0; x < child2.getChildCount(); x++) {
Log.e("TIAOSHI###", "----fiveNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); AccessibilityNodeInfo child3 = child2.getChild(x);
for (int h = 0; h < child3.getChildCount(); h++) { // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
AccessibilityNodeInfo child4 = child3.getChild(h); // nodeZuobiao(child3);
Log.e("TIAOSHI###", "----sixNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
int childCount = child4.getChildCount(); if ("android.widget.FrameLayout".equals(child3.getClassName())) {
Log.e("TIAOSHI###", "----sixNode数量:" + childCount); if (x == 0) {
nodeZuobiao(child4); for (int r = 0; r < child3.getChildCount(); r++) {
for (int m = 0; m < child4.getChildCount(); m++) { AccessibilityNodeInfo child4 = child3.getChild(r);
AccessibilityNodeInfo child5 = child4.getChild(m); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription()); nodeZuobiao(child4);
nodeZuobiao(child5);
for (int p = 0; p < child5.getChildCount(); p++) {
if(p==0){ for (int m = 0; m < child4.getChildCount(); m++) {
continue; AccessibilityNodeInfo child5 = child4.getChild(m);
}
AccessibilityNodeInfo child6 = child5.getChild(p); if ("com.lynx.tasm.behavior.ui.view.UIView".equals(child5.getClassName())) {
Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription()); if ("关注".equals(child5.getContentDescription())) {
nodeZuobiao(child6); Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
if("关注".equals(child6.getContentDescription())) { nodeZuobiao(child5);
clickcommontwo(child6, ""); clickcommontwo(child5, "关注");
}
} }
} }
} }
} }
} }
} }
} }
} }
} }
} }
} }
} }
/**
* 获得顶部导航控件
*
* @return
*/
public AccessibilityNodeInfo getdaohang() {
AccessibilityNodeInfo childw = null;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
if ("android.widget.HorizontalScrollView".equals(child.getClassName())) {
childw = child;
}
}
return childw;
}
} }

View File

@@ -1062,7 +1062,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
liwuBean.setLiwuTime(s0); liwuBean.setLiwuTime(s0);
String s1 = oneInfos.get(1).getText().toString(); String s1 = oneInfos.get(1).getText().toString();
liwuBean.setLiwuName(s1); liwuBean.setLiwuName(s1);
String s2 = oneInfos.get(2).getText().toString(); // String s2 = oneInfos.get(2).getText().toString();
if(s1.equals("大啤酒")) { if(s1.equals("大啤酒")) {
liwuBean.setLiwuDanjia("2"); liwuBean.setLiwuDanjia("2");
}else if(s1.equals("小心心")){ }else if(s1.equals("小心心")){

View File

@@ -394,7 +394,15 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:visibility="invisible"
> >
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_cancle"
tools:ignore="ObsoleteLayoutParam" />
</RelativeLayout> </RelativeLayout>
@@ -402,7 +410,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:visibility="invisible"
> >
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_cancle"
tools:ignore="ObsoleteLayoutParam" />
</RelativeLayout> </RelativeLayout>
@@ -410,7 +425,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:visibility="invisible"
> >
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_cancle"
tools:ignore="ObsoleteLayoutParam" />
</RelativeLayout> </RelativeLayout>