"ui";
ui.layout(
<vertical padding="16">
<!-- lines属性用来设置输入框的行数 -->
<text text="设置国家代码" textColor="black" textSize="16sp" marginTop="16"/>
<input id="qq" hint="请输入"/>
<button id="ok" text="确定" w="auto" style="Widget.AppCompat.Button.Colored"/>
</vertical>
);
ui.ok.click(()=>{
var text = ui.qq.text();
log(text)
if(text.length == 0){
ui.qq.setError("输入不能为空");
return;
}
//gotodo("haha");
threadMain = threads.start(xunhuan);
/*
for(var num=0;num<10;num++){
//dengdai();
//xtext=gettext(text)
//log(num+":"+xtext);
//sleep(1000)
//gotodo(xtext);
}*/
//var qq = parseInt(text);
//if(qq < 10000){
// ui.qq.setError("QQ号码格式错误");
// return;
//}
//ui.qq.setError(null);
});
function gettext(country){
var path = "/sdcard/1"+country+".txt";
//打开文件
var file = open(path);
//读取文件的所有内容
var text = file.read();
//打印到控制台
//log("这是新的");
//log(text);
sz=text.split("\n");
//print(sz[0]);
xcount=sz.length-1;
xnum=random(0,xcount);
xtext=sz[xnum];
return xtext;
}
function gotodo(text){
sleep(1000)
let d=className("android.widget.EditText").text("What's your product experience after using it?").findOne()
click(d.bounds().centerX(), d.bounds().centerY())
sleep(1500);
let e=className("android.widget.TextView").text("Anonymous").findOne()
click(e.bounds().centerX(), e.bounds().centerY())
sleep(1500);
setClip(text);
//toast(getClip());
paste();
sleep(500)
let g=className("android.widget.TextView").text("Submit ").findOne()
click(g.bounds().centerX(), g.bounds().centerY())
sleep(1500);
let f=className("android.widget.TextView").text("Review Product").findOne().parent()
click(f.bounds().centerX(), f.bounds().centerY())
sleep(1500);
}
function jinru(){
sleep(1000);
textContains("Account").waitFor();
let a=id("title").className("android.widget.TextView").text("Account").findOne()
click(a.bounds().centerX(), a.bounds().centerY())
sleep(1500);
let b=className("android.widget.TextView").text("To Review").findOne()
click(b.bounds().centerX(), b.bounds().centerY())
sleep(1500);
id("lazada_windvane_webview_container").untilFind()
let c=id("lazada_windvane_webview_container").findOne()
click(c.bounds().centerX(), c.bounds().centerY())
sleep(1500);
}
function xunhuan(){
auto.waitFor()
var text = ui.qq.text();
//log("嘿嘿"+text)
launchApp('Lazada');
sleep(1500);
jinru();
for(var num=0;num<20;num++){
xtext=gettext(text)
gotodo(xtext);
//log("heihei"+xtext)
//log("执行第:"+num)
sleep(1500)
}
toast("完成");
}
文章评论