auto.js 实现 外部直接跳转指定微信聊天记录 持续更新
目前实现功能:1 打开微信 2 从微信的其他页面返回主页 3 点击微信底部第一个tab 4 查找指定聊天记录 5 点击聊天记录进入聊天页面
function openWxCall(){
home();
sleep(200);
//需要开启后题啊弹出权限
var isEx = launchApp('微信');
sleep(200);
//找到底部微信按钮 tab
var wxTab = id("icon_tv").className("android.widget.TextView").text("微信").findOne(1000)
while(wxTab == null){
back();
sleep(100);
wxTab = id("icon_tv").className("android.widget.TextView").text("微信").findOne(1000)
}
console.log(isEx);
var h6yItem = id("h6y").findOne();
var h6yItemParent= h6yItem.parent();
var h6yItemParentClassName = h6yItemParent.className();
//因为tab的最外层是一个 RelativeLayout
while(h6yItemParentClassName != "android.widget.RelativeLayout"){
h6yItemParent = h6yItemParent.parent();
h6yItemParentClassName = h6yItemParent.className();
}
h6yItemParent.click();
sleep(100);
//找到 指定的聊天item
var target = id("kbq").className("android.view.View").text("眰恦").findOne(1000);
while(target == null){
scrollDown(0);
console.log("=======3");
target = id("kbq").className("android.view.View").text("眰恦").findOne(1000);
}
var targetParent = target.parent();
var targetParentClassName = targetParent.className();
while(targetParentClassName != "android.widget.ListView"){
target = targetParent
targetParent = targetParent.parent()
targetParentClassName = targetParent.className()
}
target.click()
sleep(500)
//找到底部添加按钮
var bottomAddBtn = id("bjz").findOne(1000)
bottomAddBtn.click()
sleep(1000)
console.log("========"+id("a11").findOne(1000).parent().parent().parent().parent().parent().className())
var pzBounds = text("拍摄").findOne(1000).parent().bounds()
click(pzBounds.centerX(), pzBounds.centerY());
}
openWxCall();