看了好多钉钉自动打卡的文章,无一例外都是需要使用python、js、java等编写各种脚本代码,使用门槛有点高,由于钉钉经常更新(UI可能会变化),所以打卡脚本也可能需要更新,维护脚本的成本也是个问题。
最近一直在研究冰狐智能辅助,发现可以使用自动构建脚本来实现自动打卡,还不需要编程,仅仅配置下参数就ok,后续的维护改下参数就可以简单多了,最最最关键的是还支持远程遥控打卡。
准备工作:
旧android手机一部,手机连上网络并放在公司里面
手机安装钉钉并登录,钉钉版本6.5.10,注意不要安装其他版本的钉钉,否则有可能打卡失败
注册冰狐智能辅助账号手机安装冰狐智能辅助app并登录
具体的准备过程请看这里,请务必严格按照文档说明做,否则有可能运行不了。
打卡业务逻辑
由于自动打卡的原理是模拟人工打卡过程,所以我们需要先熟悉下手工是怎么打卡的,如下所示:
打开钉钉
点击进入“工作台”
点击进入“考勤打卡”页面
点击上班打卡(或者下班打卡)
实现自动打卡
为了方便其他不会编程的同学,以及后续维护方便,我们使用冰狐智能辅助的自动构建脚本功能来实现自动打卡,仅需配置参数即可。
1.创建自动构建
打开网页「移动端」/「自动构建脚本」,新建一个名为“钉钉自动打卡”的构建,并点击“配置构建”按钮,开始选择模块和参数
2.选择模块、配置参数
如上图所示,点击“main”模块的“编辑按钮”。 根据上面的打卡业务逻辑来选择合适的模块并配置参数:
打开钉钉,选择“启动APP”模块,配置钉钉的包名和tag名,参数如下图所示:
点击进入“工作台”,选择“点击进入页面”模块,配置click tag和check tag,参数如下图所示:
点击进入“考勤打卡”页面,选择“点击进入页面”模块,配置click tag和check tag,参数如下图所示:
点击上班打卡(或者下班打卡),选择“点击”模块,参数如下图所示:
完整的模块及其相关配置参数:可以直接在自动构建处,点击“钉钉自动打卡”右边的“配置源码”按钮,把如下配置数据粘贴进去即可自动生成自动构建。
{
"type": "root",
"children": [{
"type": "declareVar",
"var": [{
"name": "temp",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "ret",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "view",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "viewContainer",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "tag",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "item",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "index",
"type": "normal",
"initType": "null",
"initValue": "null"
}, {
"name": "data",
"type": "normal",
"initType": "string",
"initValue": ""
}, {
"name": "text",
"type": "normal",
"initType": "string",
"initValue": ""
}]
}, {
"type": "main",
"desc": "业务逻辑入口",
"debug": false,
"params": [],
"children": [{
"type": "launchApp",
"desc": "启动APP",
"debug": false,
"packageName": "com.alibaba.android.rimet",
"tag": "txt:消息|txt:我的#",
"failed": "",
"maxStep": "30",
"children": [{
"type": "clickAndEnter",
"desc": "进入工作台",
"class": 1,
"debug": false,
"clickTag": "txt:工作台#",
"root": "",
"clickWidgetIndex": "0",
"family": [],
"descendant": [],
"checkTag": "txt:应用中心#",
"mode": "2",
"failed": "",
"duration": "500",
"maxStep": "5",
"beforeWait": "0",
"afterWait": "5000",
"children": [{
"type": "clickAndEnter",
"desc": "进入考勤页面",
"class": 1,
"debug": false,
"clickTag": "txt:考勤打卡#",
"root": "",
"clickWidgetIndex": "0",
"family": [],
"descendant": [],
"checkTag": "txt:统计|txt:打卡#",
"mode": "2",
"failed": "",
"duration": "500",
"maxStep": "15",
"beforeWait": "0",
"afterWait": "5000",
"children": [{
"type": "click",
"desc": "点击打卡",
"class": 1,
"debug": false,
"tag": "txt:上班打卡|txt:下班打卡#",
"root": "",
"widgetIndex": "0",
"family": [],
"descendant": [],
"mode": "2",
"failed": "",
"maxStep": "15",
"longClick": false,
"random": true,
"duration": "500",
"beforeWait": "0",
"afterWait": "1000"
}]
}]
}]
}]
}],
"desc": "根模块",
"debug": false
}
测试运行
请按如下步骤运行测试
开启冰狐智能辅助app调试模式
把自动构建编译成js脚本,在网页端「移动端」/「自动构建脚本」找到“钉钉自动打卡”,然后点击右边的“编译”按钮,即可自动生成名“钉钉自动打卡”的js脚本。
远程运行js脚本,在网页端「移动端」/「移动端脚本」找到到“钉钉自动打卡”,先点击“发布”按钮,然后再点击“运行”按钮,选择设备,开始执行脚本。