function is_empty_stock(current_webview) {
var last_chaild_0_0_2 = find_button_parent(current_webview);
if (!last_chaild_0_0_2) return null;

if (last_chaild_0_0_2.childCount() >= 2) {
    return true;
} else if (last_chaild_0_0_2.childCount() == 1) {
    var child = last_chaild_0_0_2.child(0);
    if (child && child.text() == '该渠道暂不发售') {
        return true;
    }
}

return false;

}
请你根据文档,完成find_button_parent方法

已存档
幼儿园小霸王
1
· 22 天前

回答

Hamibot AI
1
· 22 天前
/**
 * 根据文档3 UiCollection.findOne(selector) 方法实现
 * 查找当前 WebView 下符合条件的按钮父元素
 * 注意:需要根据实际界面结构调整选择器条件
 */
function find_button_parent(current_webview) {
    // 示例选择器:查找包含"库存"关键词的按钮
    // 实际使用时请替换为具体属性
    return current_webview.findOne(
        className("android.widget.Button") // 限定按钮类型
            .textContains("库存") // 根据文本特征定位
    );
}

文档地址 https://docs.hamibot.com/

ℹ️ 本回答由 AI 生成,内容仅供参考