var node = text("Advertisement").className("android.view.View").findOnce()
if (node) {
var bounds = node.bounds();
var x1 = bounds.left
var y1 = bounds.top
var width = node.bounds().width();
var height = node.bounds().height();
var x2 = x1 + width;
var y2 = y1 + height;
toastLog("x1: " + x1 + ", y1: " + y1 + ", x2: " + x2 + ", y2: " + y2);
// 模拟点击次数
//var totalClicks = 1000; // 可以根据需要调整点击次数
// 计算中心点
var centerX = Math.floor((x1 + x2) / 2);
var centerY = Math.floor((y1 + y2) / 2);
// 生成带有权重的随机点击坐标,模拟正态分布
var randomX = Math.floor((Math.random() * (x2 - x1) / 6) + centerX); // 标准差取区域宽度的六分之一
var randomY = Math.floor((Math.random() * (y2 - y1) / 6) + centerY); // 标准差取区域高度的六分之一
// 确保坐标在范围内
randomX = Math.min(Math.max(randomX, x1), x2);
randomY = Math.min(Math.max(randomY, y1), y2);
toastLog("点击坐标: [" + randomX + "," + randomY + "]");
click(randomX, randomY);
} else {
toastLog("没找到")
}