This commit is contained in:
2021-09-24 15:31:30 +08:00
parent 1206a0f336
commit a81217a0b6
3 changed files with 23 additions and 75 deletions

View File

@@ -47,82 +47,18 @@ public class TestAblStep0 extends BaseAblStep {
case AblSteps.STEP_2: case AblSteps.STEP_2:
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
// getNodeInfoh(); // getNodeInfoh();
clickmenu("5"); // geliwu("");
geliwu(""); AblService.getInstance().clickPoint(100, 100, 200);
break; break;
default: default:
} }
} }
/**
* 点击礼物下面的菜单
* 1.礼物
* 2.表情
* 3.粉丝团
* 4.等级
* 5.背包
*/
public void clickmenu(String type) {
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
for (int i = 0; i < root.getChildCount(); i++) {
AccessibilityNodeInfo child = root.getChild(i);
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y);
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());
switch (type) {
case "1"://礼物
if ("android.widget.TextView".equals(child3.getClassName())) {
if (child3.getText() != null) {
if (child3.getText().toString().equals("礼物")) {
AblService.getInstance().clickcommontwo(child3, "");
}
}
}
break;
case "2"://表情
if ("android.widget.TextView".equals(child3.getClassName())) {
if (child3.getText().toString().equals("表情")) {
AblService.getInstance().clickcommontwo(child3, "");
}
}
break;
case "3"://粉丝团
if ("android.widget.TextView".equals(child3.getClassName())) {
if (child3.getText().toString().equals("粉丝团")) {
AblService.getInstance().clickcommontwo(child3, "");
}
}
break;
case "4"://等级
if ("android.widget.TextView".equals(child3.getClassName())) {
if (child3.getText().toString().equals("等级")) {
AblService.getInstance().clickcommontwo(child3, "");
}
}
case "5"://背包
if ("android.widget.TextView".equals(child3.getClassName())) {
if (child3.getText().toString().equals("背包")) {
AblService.getInstance().clickcommontwo(child3, "");
}
}
break;
default:
}
}
}
}
}
}
/** /**
* 获得背包中第一排位置的了礼物 * 获得背包中第一排位置的了礼物
*/ */
private void geliwu(String text) { private int geliwu(String text) {
int doubiNum = 0;
ArrayList<LiwuBean> liwuBeans = new ArrayList<>(); ArrayList<LiwuBean> liwuBeans = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> oneInfos = new ArrayList<>(); ArrayList<AccessibilityNodeInfo> oneInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> twoInfos = new ArrayList<>(); ArrayList<AccessibilityNodeInfo> twoInfos = new ArrayList<>();
@@ -144,12 +80,12 @@ public class TestAblStep0 extends BaseAblStep {
// nodeZuobiao(child2); // nodeZuobiao(child2);
for (int x = 0; x < child2.getChildCount(); x++) { for (int x = 0; x < child2.getChildCount(); x++) {
AccessibilityNodeInfo child3 = child2.getChild(x); AccessibilityNodeInfo child3 = child2.getChild(x);
// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
// nodeZuobiao(child3); nodeZuobiao(child3);
Rect rect = new Rect(); Rect rect = new Rect();
child3.getBoundsInScreen(rect); child3.getBoundsInScreen(rect);
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 40 && rect.right <= 248) { if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 37 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3); nodeZuobiao(child3);
@@ -188,6 +124,13 @@ public class TestAblStep0 extends BaseAblStep {
Gson gson = new Gson(); Gson gson = new Gson();
String s1 = gson.toJson(liwuBeans); String s1 = gson.toJson(liwuBeans);
Log.e("礼物的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}] Log.e("礼物的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}]
for(int j=0;j<liwuBeans.size();j++){
LiwuBean liwuBean = liwuBeans.get(j);
String liwuDoubi = liwuBean.getLiwuDoubi();
int integer = Integer.valueOf(liwuDoubi);
doubiNum = integer+doubiNum;
}
return doubiNum;
} }
private void addLiwuData(ArrayList<LiwuBean> liwuBeans, ArrayList<AccessibilityNodeInfo> oneInfos) { private void addLiwuData(ArrayList<LiwuBean> liwuBeans, ArrayList<AccessibilityNodeInfo> oneInfos) {
@@ -214,9 +157,13 @@ public class TestAblStep0 extends BaseAblStep {
Log.e("TIAOSHI###", "----礼物个数=:" + substring); Log.e("TIAOSHI###", "----礼物个数=:" + substring);
} }
liwuBean.setLiwuNum(liwusubstring+""); liwuBean.setLiwuNum(liwusubstring+"");
String liwuDanjia = liwuBean.getLiwuDanjia();
int danjia = Integer.valueOf(liwuDanjia);
liwuBean.setLiwuDoubi(liwusubstring*danjia+"");
liwuBeans.add(liwuBean); liwuBeans.add(liwuBean);
} }
} }
} }

View File

@@ -57,6 +57,7 @@ public class TestAblStep31 extends HongbaoBase {
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
allowed(); allowed();
AblViewUtil.mySleep(5); AblViewUtil.mySleep(5);
Log.e("TIAOSHI###", "是否抢红包"+ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()+"");
if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) {
AblService.getInstance().clickPoint(90, 163, 300); AblService.getInstance().clickPoint(90, 163, 300);
AblViewUtil.mySleep(3); AblViewUtil.mySleep(3);
@@ -77,7 +78,7 @@ public class TestAblStep31 extends HongbaoBase {
if (ifControlView()) { if (ifControlView()) {
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
kongjiandingweitwo(); kongjiandingweitwo();
if (!ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) { if (ProfileSpUtils.getInstance().getLiveSuiJiBean().getSwitchfive()) {
boolean shifouyoufudai = shifouyoufudai(); boolean shifouyoufudai = shifouyoufudai();
Log.e("TIAOSHI###", "是否有福袋控件" + shifouyoufudai); Log.e("TIAOSHI###", "是否有福袋控件" + shifouyoufudai);
if (!shifouyoufudai) { if (!shifouyoufudai) {
@@ -646,7 +647,7 @@ public class TestAblStep31 extends HongbaoBase {
public void run() throws Exception { public void run() throws Exception {
//关闭结果弹框 //关闭结果弹框
AblService.getInstance().clickPoint(100, 100, 300); AblService.getInstance().clickPoint(100, 100, 200);
// closedjieguo(); // closedjieguo();
//继续抢福袋 //继续抢福袋
AblStepHandler.sendMsg(AblSteps.STEP_222); AblStepHandler.sendMsg(AblSteps.STEP_222);

View File

@@ -771,7 +771,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
Log.e("TIAOSHI###", "slidingDir==" + slidingDir); Log.e("TIAOSHI###", "slidingDir==" + slidingDir);
} }
Log.e("TIAOSHI###", "滑——滑动后直播间的位置" + livePosition); Log.e("TIAOSHI###", "滑——滑动后直播间的位置" + livePosition);
AblViewUtil.mySleep(3); AblViewUtil.mySleep(1);
tagControlView("", livePosition); tagControlView("", livePosition);
AblStepHandler.sendMsg(AblSteps.STEP_254); AblStepHandler.sendMsg(AblSteps.STEP_254);
@@ -1030,7 +1030,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
Rect rect = new Rect(); Rect rect = new Rect();
child3.getBoundsInScreen(rect); child3.getBoundsInScreen(rect);
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 40 && rect.right <= 248) { if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 37 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
nodeZuobiao(child3); nodeZuobiao(child3);