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.
48 lines
1.3 KiB
48 lines
1.3 KiB
|
|
function clickbutton(buttonid)
|
|
{
|
|
if (buttonid)
|
|
{
|
|
var button = id(buttonid).visibleToUser().findOne();
|
|
if (button)
|
|
{
|
|
var bounds = button.bounds();
|
|
var centerX = bounds.centerX();
|
|
var centerY = bounds.centerY();
|
|
click(centerX,centerY);
|
|
}
|
|
}
|
|
}
|
|
launchApp("小红书");
|
|
sleep(3000);
|
|
var addButtonId = 'com.xingin.xhs:id/dvd';//需要修改
|
|
clickbutton(addButtonId);
|
|
sleep(1000);
|
|
var wenzi = text("文字").findOne();
|
|
click("文字");
|
|
var taolunId = 'com.xingin.xhs:id/ca8'; //需要修改
|
|
clickbutton(taolunId);
|
|
// 定义评论内容
|
|
var comments = ["好天气!", "赞一个!", "好开心!", "软件工程!", "auto.js!"];
|
|
//找评论框
|
|
var kuangId = 'com.xingin.xhs:id/bhc'; //需要修改
|
|
clickbutton(kuangId);
|
|
//输入评论
|
|
if (kuangId)
|
|
{
|
|
var randomComment = comments[random(0, comments.length - 1)];
|
|
log('准备输入评论: ' + randomComment);
|
|
var editText = id("bhc").findOne(2000); //要修改
|
|
setText(randomComment);
|
|
sleep(2000);
|
|
var nextId = 'com.xingin.xhs:id/bed'; //需要修改
|
|
clickbutton(nextId);
|
|
sleep(5000);
|
|
var nextId2 = 'com.xingin.xhs:id/g48'; //需要修改
|
|
clickbutton(nextId2);
|
|
sleep(2000);
|
|
var fabu = 'com.xingin.xhs:id/alz'; //需要修改
|
|
clickbutton(fabu);
|
|
}
|
|
|