zoukankan      html  css  js  c++  java
  • autoJS 网易公开课app封装函数

    环境 安卓7.0或以上 网易公开课app

    /**
     * 关注用户
     * @return bool true or false
     */
    function followUser() {
        waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");
        if (id('timeline_profile_care_btn').exists()) {
            var text = id('timeline_profile_care_btn').findOnce().text();
            if (text == "关注") {
                id('timeline_profile_care_btn').click();
                log('关注成功');
                return true;
            } else if (text == "已关注") {
                log('已关注');
                return true;
            } else {
                log('关注失败');
                return false;
            }
    
        } else {
            log("ERROR:未找到控件");
            return false;
        }
    }
    
    
    /**
     * 获取用户性别
     * @return str gender 
     */
    function getUserGender() {
        if (!requestScreenCapture()) {
            toast("请求截图失败");
            exit();
        }
        waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");
        if (id('timeline_profile_gender').exists()) {
            var rect = id('timeline_profile_gender').findOnce().bounds();
            var img = captureScreen();
            var point = findColor(img, -622207, {
                region: [rect.left, rect.top, rect.width(), rect.height()],
                threshold: 4
            });
            if (point) {
                return "女";
            } else {
                var point = findColor(img, -7943189, {
                    region: [rect.left, rect.top, rect.width(), rect.height()],
                    threshold: 4
                });
                if (point) {
                    return "男";
                }
            };
    
        } else {
            return "未知";
        }
    }
    /**
     * 获取用户昵称
     * @return str userName
     */
    function getUserName() {
        var userName = '';
        //等待个人人资料页面出现
        waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");
        if (id('mid_title').exists()) {
            userName = id('mid_title').findOnce().text();
        } else {
            log('ERROR:未获取到用户昵称');
        }
        return userName;
    }
    
  • 相关阅读:
    spring boot redis 使用代码配置 redis的连接信息
    mysql Last_SQL_Error
    mysql relay log
    idea插件开发
    全网唯一正常能用的centos7 安装mysql5.7.35 22 33 25
    LVM逻辑卷管理器
    git提交代码
    数据中心统一网络实战:FCoE部署指南
    详解HBA、NIC与CNA的区别
    存储网络 – 了解FCoE的八个技术细节
  • 原文地址:https://www.cnblogs.com/qinsilandiao/p/12128723.html
Copyright © 2011-2022 走看看