废话不多说。
//先向上滑动10次,以后再10000次
dw = device.width;
dh = device.height;
for(let i = 1;i<100;i++){
sleep(100)
swipe( dw/2,dh*0.85, dw/2, dh*0.1 ,200)
}
//先向上滑动10次,以后再10000次
dw = device.width;
dh = device.height;
for(let i = 1;i<300;i++){
sleep(100)
swipe( dw/2,dh*0.85, dw/2, dh*0.1 ,200)
}
//先向上滑动10次,以后再10000次
dw = device.width;
dh = device.height;
for(let i = 1;i<1000;i++){
sleep(100)
swipe( dw/2,dh*0.85, dw/2, dh*0.1 ,200)
}
//文件名==========================================================================
console.show();
var date = new Date();
var a = date.getFullYear();
var b = date.getMonth() + 1;
var c = date.getDate();
var fname = a + "-" + b + "-" + c + "_" + "贵旅" + ".xls";
console.log( fname );
console.log("正在抓取大量记录...稍等几秒");
console.show();
str = "";
vs = className("android.widget.GridView").findOne().children().forEach(function(child){
sleep(1);
str = str + child.child(0).text() + " " + child.child(1).text() + " " + child.child(2).text() + " " + child.child(3).text() + "\r\n";
console.log( child.child(0).text(), child.child(1).text(), child.child(2).text(), child.child(3).text() );
});
//写入文件
files.write("/sdcard/" + fname, str);
alert("生成完成");
就是这么丝滑。
发表评论