先上代码,少废话.
//一键亮屏
device.wakeUp();
device.wakeUpIfNeeded(); sleep(1000);
//滑开
swipe( device.width/2, device.height*0.8, device.width/2, device.height*0.1, 2000);
sleep(2000);
//一键开微信
launchApp("微信");
sleep(5000);
//到首页
tt = text("微信").findOne(3000);
if( tt ){ click( tt.bounds().centerX(), tt.bounds().centerY() ); }
//进-乐旅商城
swipe( device.width/2, device.height*0.1,device.width/2, device.height*0.8, 2000);
sleep(3000);
tt = text("乐旅商城").findOne(3000);
if( tt ){ click( tt.bounds().centerX(), tt.bounds().centerY() ); }
//点-预约报名,歇十秒
a=textContains("-").find();
a=a[1];
click( a.bounds().centerX(), a.bounds().centerY() );
sleep(10*1000);
//自动约酒店--乐旅商城
aa = text("预约申购").findOne(2000);
if( aa ){
console.show();
tm = new Date();
t1 = 10;
t2 = 0;
t3 = 0;
checkTime = function( tm1,tm3,tm3 ){
tm = new Date();
if( tm.getHours()>=t1 && tm.getMinutes()>=t2 && tm.getSeconds()>=t3 ) return true;
return false;
}
while( !checkTime() ){
tm = new Date();
console.log( tm.getHours()+":"+tm.getMinutes()+":"+tm.getSeconds() );
sleep(300);
}
console.clear();
console.log("开始点击");
t = text("预约报名").findOne(2200);
if( t ){
while( true ){
ok1 = text("确认").findOne(300);
if( ok1 ){
click( ok1.bounds().centerX(), ok1.bounds().centerY() ); sleep(200);
click( ok1.bounds().centerX(), ok1.bounds().centerY() );
continue;
}
ok1 = text("预约报名").findOne(300);
if( ok1 ){
click( ok1.bounds().centerX(), ok1.bounds().centerY() ); sleep(200);
click( ok1.bounds().centerX(), ok1.bounds().centerY() );
continue;
}
ok1 = text("我知道了").findOne(300); if( ok1 ){ device.vibrate(1000); break; }
ok1 = text("已报名").findOne(300); if( ok1 ){ device.vibrate(1000); break; }
}
}else{
alert("未找到元素1,请抓紧手工进行!")
}
console.hide();
}else{
alert("未找到元素2,请抓紧手工进行!")
}
结束.不过慢的手机基本上执行不了.卡的时间太久.
发表评论