-
Notifications
You must be signed in to change notification settings - Fork 12
/
xhs.js
133 lines (88 loc) · 3.53 KB
/
xhs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//console.log(textContains('小红薯').findOne().parent().parent());
//console.log(scrollable(true).find());
//id('com.xingin.xhs:id/k9v').findOne().scrollForward();
//id('com.xingin.xhs:id/g5d').findOne().scrollForward();//关注滑动
//id('com.xingin.xhs:id/k11').findOne().scrollForward();//粉丝滑动
//id('com.xingin.xhs:id/hf5').findOne().scrollForward();//推荐滑动
// let contains = id('com.xingin.xhs:id/cms').find();
// console.log(contains[0].children().findOne(id('com.xingin.xhs:id/jqy')));
// console.log(contains[0].children().findOne(id('com.xingin.xhs:id/jnz')));
// let a = textContains('小达人').findOne();
// console.log(a);
// log(a.parent());
// log(a.parent().parent());
// let containers = id('com.xingin.xhs:id/ks').findOne().children().find(className('android.view.ViewGroup'));
// for (let i in containers) {
// log(containers[i].children());
// console.log(containers[i].children().findOne(id('com.xingin.xhs:id/nickNameTV')));
// break;
// }
// let a = scrollable(true).find();
// console.log(a);
// id('com.xingin.xhs:id/jq').findOne().scrollForward();
// let tag = descContains('发现').findOne();
// console.log(tag.parent().children());
// console.log(textContains('39').findOne());
// console.log(textContains('39').findOne().parent().parent());
// console.log(textContains('39').findOne().parent().parent().children());
// let tag = id('com.xingin.xhs:id/f05').filter(v => {
// return v && v.bounds() && v.bounds().left > 0 && v.bounds().top > 0;
// }).findOne();
// log(tag.children());
// log(tag.parent().parent().parent().parent());
// let tag = id('fcc').findOne();
// log(tag);
// log(tag.children());
// let a = scrollable(true).find();
// console.log(a);
// id('com.xingin.xhs:id/gdo').findOne().scrollForward();
// id('com.xingin.xhs:id/b98').findOne().scrollForward();
// console.log(textContains('小红书').find());
// log(scrollable(true).find());
// let tag = id('com.xingin.xhs:id/jq').findOne();
// tag.scrollForward();
// log(id('com.xingin.xhs:id/jq').findOne().children().find(id('com.xingin.xhs:id/nickNameTV')));
// console.log(scrollable(true).find());
// id('com.xingin.xhs:id/gdo').findOne().scrollForward();
let Common = {
id(idName) {
return id('com.xingin.xhs:id/' + idName);
},
click(tag) {
click(tag.bounds().centerX(), tag.bounds().centerY());
},
sleep(second) {
sleep(second);
}
}
// function privateMsg() {
// let msg = '你好啊';
// let sendIptTag = Common.id('awc').findOne();
// console.log('开始设置私信', msg);
// sendIptTag.setText(msg);
// Common.sleep(500 + 500 * Math.random());
// //发送
// let sendBtnTag = Common.id('f7c').findOne();
// Common.click(sendBtnTag);
// console.log('点击发送');
// }
// privateMsg();
// function swipeFocusListOp() {
// let swipeFocusListOpTarge = this.id('g5d').scrollable(true).filter((v) => {
// return v && v.bounds() && v.bounds().top > 0 && v.bounds().left >= 0 && v.bounds().top >= 0;
// }).findOnce();
// swipeFocusListOpTarge.scrollForward();
// }
// swipeFocusListOp();
// console.log(scrollable(true).find());
// id('com.xingin.xhs:id/fcc').findOne().scrollForward();
// id('com.xingin.xhs:id/f09').findOne().scrollForward();
// let sendTag = Common.id('fif').textContains('发送').find();
// log(sendTag.click());
// log(textContains('游泳').find());
// log(textContains('感觉').findOne().parent().parent());
let tag = Common.id('f09').findOne();
log(tag);
if (tag) {
tag.scrollForward();
}