You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
54 lines
1.6 KiB
var appName = "小红书";
|
|
launchApp(appName);
|
|
toast("打开小红书")
|
|
sleep(3000);//确保成功打开
|
|
//点击直播标签
|
|
click("直播")
|
|
toast("点击成功")
|
|
//等待加载
|
|
sleep(2000);
|
|
function getRandomInt(min, max) {
|
|
min = Math.ceil(min);
|
|
max = Math.floor(max);
|
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
}
|
|
for (let i = 0; i <= getRandomInt(0,7); i++) { // 循环10次
|
|
// 滑动屏幕
|
|
swipe(500, 500, 500, 1500, 100); // 从屏幕底部向上滑动
|
|
sleep(2000); // 等待2秒
|
|
}
|
|
for (let i = 0; i <= getRandomInt(0,14); i++) { // 循环10次
|
|
// 滑动屏幕
|
|
swipe(500, 1500, 500, 1153, 100); // 从屏幕底部向上滑动
|
|
sleep(2000); // 等待2秒
|
|
}
|
|
click(getRandomInt(15,544),getRandomInt(299,2239));
|
|
function staticComments(commentCount) {
|
|
var comments = [
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4",
|
|
"5"
|
|
];
|
|
for (var i = 0; i < commentCount; i++) {
|
|
var commentText = comments[getRandomInt(0,4)]; // 循环使用评论内容
|
|
|
|
// 查找评论输入框并点击
|
|
var commentInput = text("说点什么…").findOne(5000);
|
|
|
|
commentInput.click();
|
|
sleep(1000); // 等待输入框激活
|
|
|
|
// 输入评论内容
|
|
setText(commentText);
|
|
sleep(1000); // 等待输入内容完成
|
|
|
|
// 查找发送按钮并点击
|
|
var sendButton = text("发送").findOne(5000);
|
|
|
|
sendButton.click();
|
|
sleep(1000); // 等待发送完成
|
|
}
|
|
}
|
|
staticComments(5); |