This commit is contained in:
2021-10-27 15:02:19 +08:00
parent bc4168b6ea
commit 297bf96660
2 changed files with 27 additions and 169 deletions

View File

@@ -1071,6 +1071,8 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
liwuBean.setLiwuDanjia("9"); liwuBean.setLiwuDanjia("9");
}else if(s1.equals("玫瑰")){ }else if(s1.equals("玫瑰")){
liwuBean.setLiwuDanjia("1"); liwuBean.setLiwuDanjia("1");
}else {
liwuBean.setLiwuDanjia("0");
} }
String s3 = oneInfos.get(3).getText().toString(); String s3 = oneInfos.get(3).getText().toString();
if (s3.contains(IFCONTIAN)) { if (s3.contains(IFCONTIAN)) {

View File

@@ -114,11 +114,11 @@ public class TestAblStep6 extends BaseAblStep {
case AblSteps.STEP_14: case AblSteps.STEP_14:
//获取一屏幕数据:快照 //获取一屏幕数据:快照
AccessibilityNodeInfo roott = AblService.getInstance().getRootInActiveWindow(); AccessibilityNodeInfo roott = AblService.getInstance().getRootInActiveWindow();
List<AccessibilityNodeInfo> idsj = roott.findAccessibilityNodeInfosByText("查找友并关注"); List<AccessibilityNodeInfo> idsj = roott.findAccessibilityNodeInfosByText("查找友并关注");
if (idsj.size() > 0) { if (idsj.size() > 0) {
AccessibilityNodeInfo accessibilityNodeInfo = idsj.get(0); AccessibilityNodeInfo accessibilityNodeInfo = idsj.get(0);
CharSequence text1 = accessibilityNodeInfo.getText(); CharSequence text1 = accessibilityNodeInfo.getText();
if (text1.equals("查找友并关注")) { if (text1.equals("查找友并关注")) {
ChangLiang.ishuodong = "F"; ChangLiang.ishuodong = "F";
AblViewUtil.back(); AblViewUtil.back();
} }
@@ -229,132 +229,6 @@ public class TestAblStep6 extends BaseAblStep {
} }
} }
// private void cancelGuanzhu(AblService instance) {
// 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);
// for (int y = 0; y < child.getChildCount(); 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++) {
// AccessibilityNodeInfo child2 = child1.getChild(j);
//// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
//// nodeZuobiao(child2);
// for (int x = 0; x < child2.getChildCount(); x++) {
// AccessibilityNodeInfo child3 = child2.getChild(x);
// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
//// nodeZuobiao(child3);
// if ("android.widget.RelativeLayout".equals(child3.getClassName())) {
// for (int r = 0; r < child3.getChildCount(); r++) {
// AccessibilityNodeInfo child4 = child3.getChild(r);
// if ("android.widget.FrameLayout".equals(child4.getClassName())) {
// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
// for (int m = 0; m < child4.getChildCount(); m++) {
// AccessibilityNodeInfo child5 = child4.getChild(m);
// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText() + ":" + child5.getContentDescription());
// for (int p = 0; p < child5.getChildCount(); p++) {
// AccessibilityNodeInfo child6 = child5.getChild(p);
// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText() + ":" + child6.getContentDescription());
// nodeZuobiao(child5);
// yiguanzhutwo(child6);
// }
// }
// }
// }
// }
// }
// }
// }
// }
// }
// 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhutwo(AccessibilityNodeInfo child2) {
boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed();
boolean cancelcrosscor = ProfileSpUtils.getInstance().getCan().getCancelcrosscor();
if (cancelclosed && !cancelcrosscor) {
Log.e("TIAOSHI###", "QQQQQQQQQQQQQQQQQQ");
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (child2.getText() != null) {
if (child2.getText().toString().equals("已关注")) {
Rect rect = new Rect();
if (child2 != null) {
child2.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(child2, "已关注");
}
}
}
}
}
if (cancelcrosscor && !cancelclosed) {
Log.e("TIAOSHI###", "VVVVVVVVVVVVVVVVVVVVVV");
AblViewUtil.mySleep(1);
if (child2.getText() != null) {
if (child2.getText().toString().equals("互相关注")) {
Rect rect = new Rect();
if (child2 != null) {
child2.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(child2, "互相关注");
AblViewUtil.mySleep(2);
//(0,1868),(1080,2028)
AblService.getInstance().clickPoint(720, 1948, 300);
// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
// clickcommontwo(quxiao, "取消关注");
AblViewUtil.mySleep(1);
}
}
}
}
}
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);
}
}
}
}
}
}
// 3.遍历info中的子节点 (优化方法,正在测试) // 3.遍历info中的子节点 (优化方法,正在测试)
public void yiguanzhu(AccessibilityNodeInfo child2) { public void yiguanzhu(AccessibilityNodeInfo child2) {
boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed(); boolean cancelclosed = ProfileSpUtils.getInstance().getCan().getCancelclosed();
@@ -420,12 +294,6 @@ public class TestAblStep6 extends BaseAblStep {
} }
} }
} }
// AblViewUtil.mySleep(2);
// AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1);
// clickcommontwo(quxiao, "取消关注");
} }
} }
} }
@@ -445,16 +313,33 @@ public class TestAblStep6 extends BaseAblStep {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
clickcommontwo(child, "已关注"); // clickcommontwo(child, "已关注");
Rect rect = new Rect();
if (child != null) {
child.getBoundsInScreen(rect);
if (rect.top <= 2100) {
clickcommontwo(child, "已关注");
}
}
} }
if (child.getText().toString().equals("互相关注")) { if (child.getText().toString().equals("互相关注")) {
AblViewUtil.mySleep(1); AblViewUtil.mySleep(1);
clickcommontwo(child, "互相关注"); // clickcommontwo(child, "互相关注");
AblViewUtil.mySleep(2); Rect rect = new Rect();
AccessibilityNodeInfo quxiao = AblViewUtil.findByText("取消关注", 1); child.getBoundsInScreen(rect);
clickcommontwo(quxiao, "取消关注"); if (rect.top <= 2100) {
AblViewUtil.mySleep(1); clickcommontwo(child, "互相关注");
}
AblViewUtil.mySleep(2);
List<AccessibilityNodeInfo> liats = AblViewUtil.findByText("取消关注");
if(liats.size()>0) {
AblService.getInstance().clickPoint(720, 1948, 300);
AblViewUtil.mySleep(1);
}
AblViewUtil.mySleep(1);
} }
} }
} }
@@ -540,34 +425,5 @@ public class TestAblStep6 extends BaseAblStep {
} }
} }
} }
/**
* 获得取消关注
*/
private AccessibilityNodeInfo getquxiaoguanzhu() {
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 ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) {
if ("android.widget.HorizontalScrollView".equals(child.getClassName())) {
// Log.e("TIAOSHI###ViewPager", "----twoNode:" + child.getChildCount());
for (int y = 0; y < child.getChildCount(); y++) {
AccessibilityNodeInfo child1 = child.getChild(y);
// Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
if ("android.widget.TextView".equals(child1.getClassName())) {
CharSequence text = child1.getText();
if (text != null) {
if (text.toString().contains("# 互相关注")) {
nodeinfo = child1;
}
}
}
}
}
}
return nodeinfo;
}
} }