逻辑很简单,在抖音视频播完之后如果是红包视频,会跳出红包。 我们模拟逻辑如下:
点击屏幕中央,如果有红包打开红包,没有红包则暂停视频。
点击返回按钮,如果有红包关闭红包界面,没有红包提示再按一次退出(其实没退出)。
进行上滑操作,进入下一个视频。
点击、返回、上滑,就这么三步行为,无论有红包没红包都成立,只要计算好时间就行。
代码
下面是一段 node.js 代码:
touch.js
var process = require('child_process');
function exec(shell) {
process.exec(shell,function (error, stdout, stderr) {
if (error !== null) {
console.log('exec error: ' + error);
}
});
}
function click() {
console.log('click')
exec(`adb shell input tap 400 600`)
setTimeout(back, 1000)
}
function swipe() {
console.log('swipe')
exec(`adb shell input swipe 400 800 400 0 500`)