From 03d7e71de210448fea1512baa06a716fa885a6ad Mon Sep 17 00:00:00 2001 From: p7pxq89ba <1552050042@qq.com> Date: Sat, 2 Nov 2024 19:18:24 +0800 Subject: [PATCH] ADD file via upload --- jingtaipl.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 jingtaipl.js diff --git a/jingtaipl.js b/jingtaipl.js new file mode 100644 index 0000000..2faa519 --- /dev/null +++ b/jingtaipl.js @@ -0,0 +1,54 @@ +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); \ No newline at end of file