This commit is contained in:
2021-11-13 11:24:53 +08:00
parent 23970efa6a
commit 2315bb33a3
6 changed files with 404 additions and 222 deletions

View File

@@ -208,7 +208,7 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
Rect rect = new Rect(); Rect rect = new Rect();
if (child2 != null) { if (child2 != null) {
child2.getBoundsInScreen(rect); child2.getBoundsInScreen(rect);
if (rect.top >= 2092 && rect.bottom <= 2151 && rect.left >= 800) { if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) {
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if ("android.widget.TextView".equals(child2.getClassName())) { if ("android.widget.TextView".equals(child2.getClassName())) {
if (child2.getText() != null) { if (child2.getText() != null) {

View File

@@ -17,7 +17,9 @@ import com.fisherbone.fuzhu.abllib.BaseAblStep;
import com.fisherbone.fuzhu.abllib.utils.AblViewUtil; import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.db.CommentBeanData; import com.fisherbone.fuzhu.db.CommentBeanData;
import com.fisherbone.fuzhu.entity.FensiBean; import com.fisherbone.fuzhu.entity.FensiBean;
import com.fisherbone.fuzhu.entity.LiwuBean;
import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.fisherbone.fuzhu.utils.ProfileSpUtils;
import com.google.gson.Gson;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -35,6 +37,7 @@ class NoticeBase extends BaseAblStep {
public String IFCONTIAN="x"; public String IFCONTIAN="x";
private static final String TAG = "Conmon"; private static final String TAG = "Conmon";
private String conment; private String conment;
private int liwusubstring;
@Override @Override
public void onStep(int step, Message msg) { public void onStep(int step, Message msg) {
@@ -634,28 +637,120 @@ class NoticeBase extends BaseAblStep {
/** /**
* 获得背包中第一个位置的了礼物 * 获得背包中第一个位置的了礼物
*/ */
public List<AccessibilityNodeInfo> geliwu() { public ArrayList<LiwuBean> geliwu() {
List<AccessibilityNodeInfo> liwus = new ArrayList<>(); int doubiNum = 0;
ArrayList<LiwuBean> liwuBeans = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> oneInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> twoInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> threeInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> fourInfos = new ArrayList<>();
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());
// 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());
// 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);
if ("android.view.ViewGroup".equals(child2.getClassName())) { Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription()); nodeZuobiao(child2);
liwus.add(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() + ":" + child1.getContentDescription()); // nodeZuobiao(child3);
// }
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
Rect rect = new Rect();
child4.getBoundsInScreen(rect);
if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
oneInfos.add(child4);
}
if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) {
Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
twoInfos.add(child4);
}
if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) {
Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
threeInfos.add(child4);
}
if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) {
Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
fourInfos.add(child4);
} }
} }
} }
} }
return liwus;
} }
}
addLiwuData(liwuBeans, oneInfos);
addLiwuData(liwuBeans, twoInfos);
addLiwuData(liwuBeans, threeInfos);
addLiwuData(liwuBeans, fourInfos);
Gson gson = new Gson();
String s1 = gson.toJson(liwuBeans);
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 liwuBeans;
}
private void addLiwuData(ArrayList<LiwuBean> liwuBeans, ArrayList<AccessibilityNodeInfo> oneInfos) {
LiwuBean liwuBean = new LiwuBean();
if (oneInfos.size() > 0) {
String s0 = oneInfos.get(0).getText().toString();
liwuBean.setLiwuTime(s0);
String s1 = oneInfos.get(1).getText().toString();
liwuBean.setLiwuName(s1);
// String s2 = oneInfos.get(2).getText().toString();
if(s1.equals("大啤酒")) {
liwuBean.setLiwuDanjia("2");
}else if(s1.equals("小心心")){
liwuBean.setLiwuDanjia("1");
}else if(s1.equals("棒棒糖")){
liwuBean.setLiwuDanjia("9");
}else if(s1.equals("玫瑰")){
liwuBean.setLiwuDanjia("1");
}else {
liwuBean.setLiwuDanjia("0");
}
String s3 = oneInfos.get(3).getText().toString();
if (s3.contains(IFCONTIAN)) {
String substring = s3.substring(1);
liwusubstring = Integer.valueOf(substring);
Log.e("TIAOSHI###", "----礼物个数=:" + substring);
}
liwuBean.setLiwuNum(liwusubstring+"");
String liwuDanjia = liwuBean.getLiwuDanjia();
int danjia = Integer.valueOf(liwuDanjia);
liwuBean.setLiwuDoubi(liwusubstring*danjia+"");
liwuBeans.add(liwuBean);
}
}
/** /**
* 点击加关注 * 点击加关注

View File

@@ -33,6 +33,7 @@ public class TestAblStep0 extends BaseAblStep {
public String IFCONTIAN = "x"; public String IFCONTIAN = "x";
private int liwusubstring; private int liwusubstring;
private RedEnvBean redEnvBean; private RedEnvBean redEnvBean;
@Override @Override
public void onStep(int step, Message msg) { public void onStep(int step, Message msg) {
switch (step) { switch (step) {
@@ -47,24 +48,74 @@ public class TestAblStep0 extends BaseAblStep {
//点开礼物 //点开礼物
clickmoreli(); // clickmoreli();
Log.e("TIAOSHI###", "打开礼物"); // Log.e("TIAOSHI###", "打开礼物");
AblViewUtil.mySleep(1); // AblViewUtil.mySleep(1);
int doubinum = dangqianDoubi(); // int doubinum = dangqianDoubi();
Log.e("TIAOSHI###当前抖币数",doubinum+""); // Log.e("TIAOSHI###当前抖币数",doubinum+"");
AblViewUtil.mySleep(2); // AblViewUtil.mySleep(2);
clickmenu("5"); // clickmenu("5");
AblViewUtil.mySleep(2); // AblViewUtil.mySleep(2);
int geliwu = geliwu(""); // int geliwu = geliwu("");
Log.e("TIAOSHI###背包里的抖币数",geliwu+""); // Log.e("TIAOSHI###背包里的抖币数",geliwu+"");
redEnvBean.setLivedoubinumfir(doubinum + geliwu + ""); // redEnvBean.setLivedoubinumfir(doubinum + geliwu + "");
Log.e("TIAOSHI###", "初始抖币数" + redEnvBean.getLivedoubinumfir()); // Log.e("TIAOSHI###", "初始抖币数" + redEnvBean.getLivedoubinumfir());
AblViewUtil.mySleep(1); // AblViewUtil.mySleep(1);
AblViewUtil.back(); // AblViewUtil.back();
AccessibilityNodeInfo hognbaonode = geliwu("小心心").get(0);
clickcommonthree(hognbaonode, "");
default: default:
} }
} }
@RequiresApi(api = Build.VERSION_CODES.N)
public void clickcommonthree(AccessibilityNodeInfo accessibilityNodeInfo, String s) {
if (accessibilityNodeInfo != null) {
Rect rect = new Rect();
accessibilityNodeInfo.getBoundsInScreen(rect);
AblService.getInstance().clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
Log.e("TIAOSHI###", "点击" + s + "按钮");
Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
} else {
Log.e("TIAOSHI###", "没有找到" + s + "按钮");
}
}
/**
* 获得背包中第一个位置的了礼物
*/
private List<AccessibilityNodeInfo> geliwu(String text) {
List<AccessibilityNodeInfo> liwus = new ArrayList<>();
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());
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
if (child4.getText() != null) {
if (text.equals(child4.getText().toString())) {
liwus.add(child4);
}
}
}
}
}
}
}
return liwus;
}
/** /**
* 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用) * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用)
* 1.说点什么 * 1.说点什么
@@ -91,6 +142,7 @@ public class TestAblStep0 extends BaseAblStep {
} }
} }
} }
public int dangqianDoubi() { public int dangqianDoubi() {
int doubinumr = 0; int doubinumr = 0;
String getdoubinum = getdoubinum(); String getdoubinum = getdoubinum();
@@ -104,6 +156,7 @@ public class TestAblStep0 extends BaseAblStep {
} }
return doubinumr; return doubinumr;
} }
public String getdoubinum() { public String getdoubinum() {
String doubinum = ""; String doubinum = "";
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
@@ -118,11 +171,13 @@ public class TestAblStep0 extends BaseAblStep {
// 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());
// nodeZuobiao(child2);
Rect rect = new Rect(); Rect rect = new Rect();
if (child2 != null) { if (child2 != null) {
child2.getBoundsInScreen(rect); child2.getBoundsInScreen(rect);
if (rect.top >= 2092 && rect.bottom <= 2151 && rect.left >= 800) { if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) {
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription()); Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if ("android.widget.TextView".equals(child2.getClassName())) { if ("android.widget.TextView".equals(child2.getClassName())) {
if (child2.getText() != null) { if (child2.getText() != null) {
String s = child2.getText().toString(); String s = child2.getText().toString();
@@ -139,6 +194,7 @@ public class TestAblStep0 extends BaseAblStep {
return "0"; return "0";
} }
/** /**
* 点击礼物下面的菜单 * 点击礼物下面的菜单
* 1.礼物 * 1.礼物
@@ -203,85 +259,91 @@ public class TestAblStep0 extends BaseAblStep {
} }
} }
} }
/** /**
* 获得背包中第一排位置的了礼物 * 获得背包中第一排位置的了礼物
*/ */
private int geliwu(String text) { // private int geliwu(String text) {
int doubiNum = 0; // 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<>();
ArrayList<AccessibilityNodeInfo> threeInfos = new ArrayList<>(); // ArrayList<AccessibilityNodeInfo> threeInfos = new ArrayList<>();
ArrayList<AccessibilityNodeInfo> fourInfos = new ArrayList<>(); // ArrayList<AccessibilityNodeInfo> fourInfos = new ArrayList<>();
//
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);
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()); // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
// 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(); // for (int r = 0; r < child3.getChildCount(); r++) {
child3.getBoundsInScreen(rect); // AccessibilityNodeInfo child4 = child3.getChild(r);
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 30 && rect.right <= 248) { // Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// nodeZuobiao(child4);
Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); //
nodeZuobiao(child3); // Rect rect = new Rect();
oneInfos.add(child3); // child4.getBoundsInScreen(rect);
// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) {
//
} // Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 248 && rect.right <= 540) { // nodeZuobiao(child4);
// oneInfos.add(child4);
Log.e("TIAOSHI###", "----fourNodetwo:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); //
nodeZuobiao(child3); //
twoInfos.add(child3); // }
// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) {
} //
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 540 && rect.right <= 810) { // Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// nodeZuobiao(child4);
Log.e("TIAOSHI###", "----fourNodehree:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); // twoInfos.add(child4);
nodeZuobiao(child3); //
threeInfos.add(child3); // }
// if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) {
} //
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 810 && rect.right <= 1080) { // Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// nodeZuobiao(child4);
Log.e("TIAOSHI###", "----fourNodefour:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); // threeInfos.add(child4);
nodeZuobiao(child3); //
fourInfos.add(child3); // }
} // if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) {
} //
} // Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
} // nodeZuobiao(child4);
} // fourInfos.add(child4);
addLiwuData(liwuBeans, oneInfos); // }
addLiwuData(liwuBeans, twoInfos); // }
addLiwuData(liwuBeans, threeInfos); // }
addLiwuData(liwuBeans, fourInfos); // }
Gson gson = new Gson(); // }
String s1 = gson.toJson(liwuBeans); // }
Log.e("礼物的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}] // addLiwuData(liwuBeans, oneInfos);
for(int j=0;j<liwuBeans.size();j++){ // addLiwuData(liwuBeans, twoInfos);
LiwuBean liwuBean = liwuBeans.get(j); // addLiwuData(liwuBeans, threeInfos);
String liwuDoubi = liwuBean.getLiwuDoubi(); // addLiwuData(liwuBeans, fourInfos);
int integer = Integer.valueOf(liwuDoubi); // Gson gson = new Gson();
doubiNum = integer+doubiNum; // String s1 = gson.toJson(liwuBeans);
} // Log.e("礼物的字符串", s1);//[{"login_status":"1","short_id":"xiao629972576","short_name":""}]
return doubiNum; // 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) {
LiwuBean liwuBean = new LiwuBean(); LiwuBean liwuBean = new LiwuBean();
if (oneInfos.size() > 0) { if (oneInfos.size() > 0) {
@@ -314,6 +376,29 @@ public class TestAblStep0 extends BaseAblStep {
liwuBeans.add(liwuBean); liwuBeans.add(liwuBean);
} }
} }
/**
* 获得背包中第一个位置的了礼物
*/
public List<AccessibilityNodeInfo> geliwu() {
List<AccessibilityNodeInfo> liwus = new ArrayList<>();
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);
if ("android.view.ViewGroup".equals(child2.getClassName())) {
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
liwus.add(child2);
}
}
}
}
return liwus;
}
} }

View File

@@ -15,6 +15,7 @@ import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
import com.fisherbone.fuzhu.db.CommentBeanData; import com.fisherbone.fuzhu.db.CommentBeanData;
import com.fisherbone.fuzhu.db.dao.CommentDao; import com.fisherbone.fuzhu.db.dao.CommentDao;
import com.fisherbone.fuzhu.entity.LiveBean; import com.fisherbone.fuzhu.entity.LiveBean;
import com.fisherbone.fuzhu.entity.LiwuBean;
import com.fisherbone.fuzhu.utils.ProfileSpUtils; import com.fisherbone.fuzhu.utils.ProfileSpUtils;
import com.fisherbone.fuzhu.utils.StringUtils; import com.fisherbone.fuzhu.utils.StringUtils;
import com.jeremyliao.liveeventbus.LiveEventBus; import com.jeremyliao.liveeventbus.LiveEventBus;
@@ -134,8 +135,6 @@ public class TestAblStep30 extends NoticeBase {
AblViewUtil.mySleep(randumInt10); AblViewUtil.mySleep(randumInt10);
} }
AblStepHandler.sendMsg(AblSteps.STEP_216); AblStepHandler.sendMsg(AblSteps.STEP_216);
//AblStepHandler.sendMsg(AblSteps.STEP_217);
// AblStepHandler.sendMsg(AblSteps.STEP_213);
break; break;
case AblSteps.STEP_216: case AblSteps.STEP_216:
if(liveBean.getSwitchfive()) { if(liveBean.getSwitchfive()) {
@@ -146,24 +145,18 @@ public class TestAblStep30 extends NoticeBase {
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
clickmenu("5"); clickmenu("5");
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
List<AccessibilityNodeInfo> geliwu = geliwu(); ArrayList<LiwuBean> geliwu = geliwu();
if (geliwu.size() > 0) { if (geliwu.size() > 0) {
//获得礼物数 //获得礼物数
AccessibilityNodeInfo nodeinfo = geliwu.get(0); LiwuBean liwuBean = geliwu.get(0);
AccessibilityNodeInfo child9 = nodeinfo.getChild(nodeinfo.getChildCount() - 1); String liwuNum = liwuBean.getLiwuNum();
if (child9.getText() != null) { liwusubstring = Integer.parseInt(liwuNum);
String str1 = child9.getText().toString(); Log.e("TIAOSHI###", "----礼物个数=:" + liwusubstring);
if (str1.contains(IFCONTIAN)) { AblService.getInstance().clickPoint(120, 1653, 300);
String substring = str1.substring(1);
liwusubstring = Integer.valueOf(substring);
Log.e("TIAOSHI###", "----礼物个数=:" + substring);
}
}
clickcommonthree(nodeinfo, "");
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
for (int i = 0; i < liwusubstring; i++) { for (int i = 0; i < liwusubstring; i++) {
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
clickcommonthree(nodeinfo, ""); AblService.getInstance().clickPoint(120, 1653, 300);
AblViewUtil.mySleep(4); AblViewUtil.mySleep(4);
} }
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
@@ -186,7 +179,7 @@ public class TestAblStep30 extends NoticeBase {
LiveBean liveBean1 = ProfileSpUtils.getInstance().getLiveBean(); LiveBean liveBean1 = ProfileSpUtils.getInstance().getLiveBean();
String liwunum = liveBean1.getLiwucishu(); String liwunum = liveBean1.getLiwucishu();
int fastnum = Integer.valueOf(liwunum); int fastnum = Integer.valueOf(liwunum);
faliwu("大啤酒", 2, fastnum); faliwu("小心心", 1, fastnum);
AblViewUtil.back(); AblViewUtil.back();
} }
int randumInt12 = RandumInt.getRandumInt10(); int randumInt12 = RandumInt.getRandumInt10();
@@ -194,42 +187,6 @@ public class TestAblStep30 extends NoticeBase {
AblStepHandler.sendMsg(AblSteps.STEP_214); AblStepHandler.sendMsg(AblSteps.STEP_214);
break; break;
case AblSteps.STEP_218: case AblSteps.STEP_218:
// //直播间刷红包
// AblViewUtil.mySleep(2);
// //点击发红包
// int getdoubi = getdoubi();
// //获得刷礼物的次数
// LiveBean liveBean1 = ProfileSpUtils.getInstance().getLiveBean();
// String hongbaonum = liveBean1.getHongbaonum();
// int fastnum = Integer.valueOf(hongbaonum);
// int fastdoubi = fastnum * 20;
// if (getdoubi >= fastdoubi) {
// } else {
// fastdoubi = getdoubi;
// }
// double num = fastdoubi / 20;
// int intnum = new Double(num).intValue();
// if (intnum > 0) {
// for (int i = 0; i < intnum; i++) {
// AblViewUtil.mySleep(1);
// //点开礼物
// clickmoreli();
// //触发容器元素的滚动事件
// ArrayList<AccessibilityNodeInfo> getrecyy = getrecyy();
// getrecyy.get(0).performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
// AblViewUtil.mySleep(3);
// List<AccessibilityNodeInfo> geliwwu = geliwu("红包");
// AccessibilityNodeInfo hognbaonode = geliwwu.get(0);
// clickcommonthree(hognbaonode, "");
// String hongbaotime = ProfileSpUtils.getInstance().getLiveBean().getHongbaotime();
// int jiangetime = Integer.valueOf(hongbaotime);
// AblViewUtil.mySleep(jiangetime);
// }
// } else {
// Log.e("TIAOSHI###", "发红包的抖币不够了");
// }
AblStepHandler.sendMsg(AblSteps.STEP_219); AblStepHandler.sendMsg(AblSteps.STEP_219);
break; break;
case AblSteps.STEP_219: case AblSteps.STEP_219:
@@ -252,7 +209,7 @@ public class TestAblStep30 extends NoticeBase {
private void faliwu(String str,int danjia,int fastnum) { private void faliwu(String str,int danjia,int fastnum) {
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
int getdoubi = getdoubi(); int getdoubi = getdoubi();
Log.e("TIAOSHI###", "当前抖币数"+getdoubi);
int fastdoubi = fastnum * danjia; int fastdoubi = fastnum * danjia;
if (getdoubi >= fastdoubi) { if (getdoubi >= fastdoubi) {
} else { } else {
@@ -731,14 +688,18 @@ public class TestAblStep30 extends NoticeBase {
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() + ":" + child1.getContentDescription()); Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
if (child3.getText() != null) { for (int r = 0; r < child3.getChildCount(); r++) {
if (text.equals(child3.getText().toString())) { AccessibilityNodeInfo child4 = child3.getChild(r);
liwus.add(child2); Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
if (child4.getText() != null) {
if (text.equals(child4.getText().toString())) {
liwus.add(child4);
}
} }
} }
} }
} }
} }
} }
return liwus; return liwus;
@@ -752,24 +713,28 @@ public class TestAblStep30 extends NoticeBase {
private int getdoubi() { private int getdoubi() {
int doubinum = 0; int doubinum = 0;
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
if (root != null) {
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);
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);
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() + ":" + child1.getContentDescription());
Rect rect = new Rect(); Rect rect = new Rect();
if (child2 != null) {
child2.getBoundsInScreen(rect); child2.getBoundsInScreen(rect);
if (rect.top >= 2092 && rect.bottom <= 2151) { if (rect.top >= 1403 && rect.bottom <= 1462 && rect.left >= 800) {
// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
if ("android.widget.TextView".equals(child2.getClassName())) { if ("android.widget.TextView".equals(child2.getClassName())) {
if (child2.getText() != null) { if (child2.getText() != null) {
String doubi = child2.getText().toString(); String s = child2.getText().toString();
Log.e("TIAOSHI###", "----抖币数:" + doubi); doubinum = Integer.valueOf(s);
doubinum = Integer.valueOf(doubi); }
}
} }
} }
} }

View File

@@ -1005,38 +1005,44 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
// 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());
// nodeZuobiao(child3);
Rect rect = new Rect();
child3.getBoundsInScreen(rect);
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 30 && 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);
oneInfos.add(child3);
for (int r = 0; r < child3.getChildCount(); r++) {
AccessibilityNodeInfo child4 = child3.getChild(r);
Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
Rect rect = new Rect();
child4.getBoundsInScreen(rect);
if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 30 && rect.right <= 248) {
Log.e("TIAOSHI###", "----fourNode:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child4);
oneInfos.add(child4);
} }
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 248 && rect.right <= 540) { if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 248 && rect.right <= 540) {
Log.e("TIAOSHI###", "----fourNodetwo:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNodetwo:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child3); nodeZuobiao(child4);
twoInfos.add(child3); twoInfos.add(child4);
} }
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 540 && rect.right <= 810) { if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 540 && rect.right <= 810) {
Log.e("TIAOSHI###", "----fourNodehree:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNodehree:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child3); nodeZuobiao(child4);
threeInfos.add(child3); threeInfos.add(child4);
} }
if (rect.top >= 1438 && rect.bottom <= 1698 && rect.left >= 810 && rect.right <= 1080) { if (rect.top >= 1526 && rect.bottom <= 1781 && rect.left >= 810 && rect.right <= 1080) {
Log.e("TIAOSHI###", "----fourNodefour:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription()); Log.e("TIAOSHI###", "----fourNodefour:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
nodeZuobiao(child3); nodeZuobiao(child4);
fourInfos.add(child3); fourInfos.add(child4);
}
} }
} }
} }

View File

@@ -229,6 +229,11 @@ public class TestAblStepXin5 extends BaseAblStep {
if (ChangLiang.guanzhunum < maxnumber) { if (ChangLiang.guanzhunum < maxnumber) {
//满足条件执行点赞关注评论 //满足条件执行点赞关注评论
if (ChangLiang.condition.equals("0")) { if (ChangLiang.condition.equals("0")) {
if (userProfie.getRandomattention()) {
//点击加关注
clickGuanzhu();
}
AblViewUtil.mySleep(2);
AblViewUtil.back(); AblViewUtil.back();
Log.e("TIAOSHI###", "满足点赞关注评论条件" + ChangLiang.condition); Log.e("TIAOSHI###", "满足点赞关注评论条件" + ChangLiang.condition);
operation(); operation();
@@ -260,6 +265,32 @@ public class TestAblStepXin5 extends BaseAblStep {
} }
} }
/**
* 详情页面点击关注
*/
private void clickGuanzhu() {
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());
nodeZuobiao(child);
Rect rect = new Rect();
child.getBoundsInScreen(rect);
if (rect.top >= 800 && rect.bottom <= 1473) {
if ("android.widget.TextView".equals(child.getClassName())) {
if(child.getText()!=null) {
if ("关注".equals(child.getText().toString())) {
clickcommontwo(child, "关注");
break;
}
}
}
}
}
}
private boolean getCondition() { private boolean getCondition() {
boolean flag = false; boolean flag = false;
@@ -360,10 +391,10 @@ public class TestAblStepXin5 extends BaseAblStep {
Log.e("TIAOSHI###", "点赞参数" + userProfie.getRandomlikes()); Log.e("TIAOSHI###", "点赞参数" + userProfie.getRandomlikes());
homeDianzan(); homeDianzan();
} }
AblViewUtil.mySleep(2); // AblViewUtil.mySleep(2);
if (userProfie.getRandomattention()) { // if (userProfie.getRandomattention()) {
addguanzhu(); // addguanzhu();
} // }
AblViewUtil.mySleep(2); AblViewUtil.mySleep(2);
//评论 //评论
if (userProfie.getRandomreview()) { if (userProfie.getRandomreview()) {