atom
This commit is contained in:
@@ -537,4 +537,25 @@ public abstract class BaseAblStep implements AblStepHandler.StepListener {
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断当前页面是否包含某文本
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,35 +131,35 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public AccessibilityNodeInfo getNodeInfoS() {
|
||||
AccessibilityNodeInfo nodeinfo = null;
|
||||
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
// Log.e("TIAOSHI###", "one----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
|
||||
for (int y = 0; y < child.getChildCount(); y++) {
|
||||
AccessibilityNodeInfo child1 = child.getChild(y);
|
||||
// Log.e("TIAOSHI###", "one----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
|
||||
if (child1 != null) {
|
||||
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);
|
||||
if (child2 != null) {
|
||||
if ("android.widget.TextView".equals(child2.getClassName())) {
|
||||
if (child2.getText() != null) {
|
||||
if ("说点什么...".equals(child2.getText().toString())) {
|
||||
nodeinfo = child2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nodeinfo;
|
||||
}
|
||||
// public AccessibilityNodeInfo getNodeInfoS() {
|
||||
// AccessibilityNodeInfo nodeinfo = null;
|
||||
// AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
// for (int i = 0; i < root.getChildCount(); i++) {
|
||||
// AccessibilityNodeInfo child = root.getChild(i);
|
||||
// // Log.e("TIAOSHI###", "one----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
|
||||
// for (int y = 0; y < child.getChildCount(); y++) {
|
||||
// AccessibilityNodeInfo child1 = child.getChild(y);
|
||||
// // Log.e("TIAOSHI###", "one----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
|
||||
// if (child1 != null) {
|
||||
// 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);
|
||||
// if (child2 != null) {
|
||||
// if ("android.widget.TextView".equals(child2.getClassName())) {
|
||||
// if (child2.getText() != null) {
|
||||
// if ("说点什么...".equals(child2.getText().toString())) {
|
||||
// nodeinfo = child2;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return nodeinfo;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用)
|
||||
@@ -570,7 +570,9 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
|
||||
AblViewUtil.mySleep(5);
|
||||
enterOneNodeInfo();
|
||||
AblViewUtil.mySleep(4);
|
||||
AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
// AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
|
||||
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
|
||||
if (nodeInfoS != null) {
|
||||
ifEnterOne = true;
|
||||
}
|
||||
@@ -891,7 +893,8 @@ class HongbaoBase extends BaseAblStep implements RedEnv.RedEnvFunc, RedEnv.TimeF
|
||||
}
|
||||
public boolean enterLivetwo() {
|
||||
boolean ifEnterOne = false;
|
||||
AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
// AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
|
||||
if (nodeInfoS != null) {
|
||||
ifEnterOne = true;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,13 @@ public class TestAblStep0 extends BaseAblStep {
|
||||
// getNodeInfoh();
|
||||
// cancelGuanzhu(AblService.getInstance());
|
||||
|
||||
int randumInt40 = RandumInt.getRandumInt40();
|
||||
zhibodianzanc(randumInt40);
|
||||
boolean nodeInfoh = ifGaunzhu();
|
||||
if(nodeInfoh){
|
||||
Log.e("TIAOSHI###", "此视频没有关注过");
|
||||
}else {
|
||||
Log.e("TIAOSHI###", "此视频已关注");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -329,6 +334,48 @@ public class TestAblStep0 extends BaseAblStep {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否关注过 (判断的准确率在百分之90之上)
|
||||
*/
|
||||
public boolean ifGaunzhu() {
|
||||
boolean flag = false;
|
||||
AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
AccessibilityNodeInfo child = root.getChild(i);
|
||||
|
||||
if ("dmt.viewpager.DmtViewPager$d".equals(child.getClassName())) {
|
||||
// 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);
|
||||
Rect rect = new Rect();
|
||||
child2.getBoundsInScreen(rect);
|
||||
if (rect.left > 0 && rect.left <= 1080 && rect.top > 0 && rect.top <= 2210 && rect.bottom > 0 && rect.bottom <= 2210 && rect.right <= 1080) {
|
||||
|
||||
Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
|
||||
nodeZuobiao(child2);
|
||||
if ("android.widget.Button".equals(child2.getClassName())) {
|
||||
if (child2.getContentDescription() != null) {
|
||||
|
||||
if ("关注".equals(child2.getContentDescription().toString())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
break;
|
||||
case AblSteps.STEP_254:
|
||||
|
||||
AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
//AccessibilityNodeInfo nodeInfoS = getNodeInfoS();
|
||||
AccessibilityNodeInfo nodeInfoS = isContainText("说点什么...");
|
||||
if (nodeInfoS != null) {
|
||||
Log.e("TIAOSHI###", "页面在直播页面");
|
||||
againStart("1");
|
||||
|
||||
@@ -136,14 +136,14 @@ public class TestAblStepXin5 extends BaseAblStep {
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_31);
|
||||
return;
|
||||
}
|
||||
boolean nodeInfoh = ifGaunzhu();
|
||||
if(nodeInfoh){
|
||||
Log.e("TIAOSHI###", "此视频没有关注过");
|
||||
}else {
|
||||
Log.e("TIAOSHI###", "此视频已关注");
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_31);
|
||||
return;
|
||||
}
|
||||
// boolean nodeInfoh = ifGaunzhu();
|
||||
// if(nodeInfoh){
|
||||
// Log.e("TIAOSHI###", "此视频没有关注过");
|
||||
// }else {
|
||||
// Log.e("TIAOSHI###", "此视频已关注");
|
||||
// AblStepHandler.sendMsg(AblSteps.STEP_31);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_29);
|
||||
|
||||
@@ -176,6 +176,8 @@ public class TestAblStepXin5 extends BaseAblStep {
|
||||
} else {
|
||||
ChangLiang.condition = "1";
|
||||
}
|
||||
}else {
|
||||
ChangLiang.condition = "1";
|
||||
}
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_30);
|
||||
}
|
||||
|
||||
@@ -390,7 +390,29 @@
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user