Coder Social home page Coder Social logo

tb618's People

Contributors

z0ow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tb618's Issues

一点建议

首先声明我不会任何编程
当这个脚本运行浏览的时候,默认时间经常因淘宝的小霸王服务器延迟原因,导致一开始不计时,几秒后(俩号测试,几秒都有)才弹出计时窗口,实际需要时长超过15s,这个脚本就不能完成浏览了
我xjb调整了那个sleep打头,括号内的时长(应该是吧,纯属瞎试),就减少了失败率
感觉大佬应该延长下时间,就能保证成功,而不用重复了

报错

20:39:56.750/E: TypeError: Cannot find function waitFor in object
function (mode) {...}. (#2)
at script(:2)
是咋回事啊

小米8首页活动按钮、搜索框定位异常

我的机型是小米 8,MIUI11 开发版对应安卓 10,已 ROOT。

不知道是否是系统或特殊机型导致的问题,我在打开淘宝后进入首页时会无法进入 618 页面,日志如下:

06:04:13.061/D: 检测无障碍模式是否开启
06:04:16.075/D: 欢迎来到领喵币脚本
Github项目: tb618
设备宽: 1080
设备高: 2248
手机型号: MI 8
安卓版本: 10
06:04:19.339/D: 打开手机淘宝
06:04:28.991/D: 当前在主界面
06:04:31.996/D: 尝试进入618列车界面
06:04:44.772/D: 进入主互动界面失败!

跟代码感觉是在首页“寻找 618 活动按钮”或者“寻找搜索框,尝试搜索入口进入活动”两个环节失败了。手动测试确认,如果我进入淘宝后,手动点击搜索,进入搜索页,可以继续后边的进程。

代码中,这个首页的活动点击块和搜索框都是根据 depth 和 index 来查找的,这块不太懂。如果方便的话,能否透露下这两个属性在 AutoJs 怎么确认,我继续排查看看。

另外有个关于搜索块定位的想法,如 Readme 中提到,淘宝“界面经常变动”。。。depth 和 index 这种属性大概也是随着首页布局调整,所以才会导致诸如 2020/06/13 这种首页层次变化就得更新代码的情况。

或许在定位搜索框的时候,可以根据 text 和 desc 来定位。比如搜索框的搜索按钮,点击会进入搜索页,和点击搜索框效果一致,这个搜索按钮是有 desc="搜索" 可以来定位的。且搜索按钮的“搜索”字段在小版本更新中变化的可能性较小。

感觉进入搜索页的代码如果用这个来做,可能会更通用

var searchButton = desc("搜索").findOnce();
click(searchButton.bounds().centerX(), searchButton.bounds().centerY()); sleep(3000);

或者这样处理效果可能会更好,页面微调后比较好处理:

// x,y 表示找到对应 text&desc 点击时的偏移量
// way 查找 text&desc 的方式,默认 equals,要求字段完全符合
// key 就是关键字段
function clickByKey (x, y, way, key) {

    switch (way) {
        case "matches":
            if (textMatches(key).exists()) {
                var keyBounds = textMatches(key).findOnce().bounds();
                click(keyBounds.centerX() + x, keyBounds.centerY() + y);
            } else if (descMatches(key).exists()) {
                var keyBounds = descMatches(key).findOnce().bounds();
                click(keyBounds.centerX() + x, keyBounds.centerY() + y);
            }
            break;
        default:
            if (textEndsWith(key).exists()) {
                var keyBounds = textEndsWith(key).findOnce().bounds();
                click(keyBounds.centerX() + x, keyBounds.centerY() + y);
            } else if (descEndsWith(key).exists()) {
                var keyBounds = descEndsWith(key).findOnce().bounds();
                click(keyBounds.centerX() + x, keyBounds.centerY() + y);
            }
    }
};

clickByKey(0, 0, "equals", "搜索"); sleep(3000);

如果改动影响稳定性,还请忽略,打扰了。
很赞的代码,感谢作者。

有几个步骤无法进行

浏览618精选榜单,去天猫农场收菜(这个大概不能完成),浏览天猫榜单频道,浏览618爆款合集

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.