|
发表于 2019-10-24 11:08:07
|
显示全部楼层
搬自52
- var str = "";
- str += "屏幕宽度:" + device.width
- str += "\n屏幕高度:" + device.height;
- toast("屏幕宽度为"+device.width+" "+"屏幕高度为"+device.height);
- //获取设备信息
- launchApp("手机淘宝");
- toast("打开手机淘宝中");
- sleep(5000)
- waitForActivity("com.taobao.tao.TBMainActivity")
- sleep(3000)
-
- //淘宝首页识别图片
-
-
- var b = text("狂欢开场").findOne().bounds();
- click(b.centerX(), b.centerY()+150);
-
-
-
-
- waitForActivity("com.taobao.browser.BrowserActivity")
- sleep(8000)
-
-
-
- if(!requestScreenCapture()){
- toast("请求截图失败");
- exit();
- }
- var C = captureScreen();
- images.saveImage(C, "/sdcard/1.png");
- //截图并保存,记得待会删掉
- var url1 = "https://s2.ax1x.com/2019/10/23/KYg3ct.jpg";
- var P = images.load(url1);
- images.save(P, "/sdcard/喵币.png");
- //这张也要删掉
-
- var j = findImage(C, P);
- if(j){
- click(j.x+50,j.y+50)
- }else{
- toast("没找到");
- }
- toast("点击领喵币")
- sleep(5000)
-
-
-
-
-
- for(var t=1;t<21;t++){ click(text("去进店").findOne().click())
- toast("点击去进店")
- sleep(3000)
- for(var i=0;i<6;i++){
-
- swipe(device.width / 2, 4*device.height/5, device.width / 2, device.height/5,1000);
- sleep(3000)
-
- }
- back()
- toast("已经逛了"+t+"次")
- sleep(3000)
-
- }
-
- while(text("去浏览").exists()){
- //判断是否有去浏览
- text("去浏览").findOne().click();
- sleep(2000)
- toast("存在并点击");
- sleep(18000)
- back()
-
-
- while(!text("去浏览").exists()){
- //如果没有去浏览,则滑动后再寻找
- swipe(device.width / 2, 4*device.height/5, device.width / 2, 2*device.height/5,1000);
- sleep(1000)
- var A=currentActivity()
- if(A=="com.taobao.tao.TBMainActivity"){
- toast("有一个需要回到天猫主页,具体是哪个刚刚我没注意到,待会我同学起床了,借他账号看看")
- exit()
- }
- }
- }
- //by 暗夜协奏者,转载不要删这句
复制代码 |
|