回答
sendButton 的类型是 UiObject。
它是通过 UiSelector 选择器匹配到的屏幕控件对象。findOne() 方法用于查找符合选择器条件的第一个控件,找到后返回 UiObject 对象,未找到则返回 null。
UiObject 对象支持多种操作方法和属性获取,常见用法包括:
- 动作操作:
click(),longClick(),setText(),scrollForward()等。 - 属性获取:
text(),id(),className(),bounds(),parent()等。
代码示例:
// 文档地址 https://docs.hamibot.com/
var sendButton = text('发送').findOne();
if (sendButton != null) {
sendButton.click();
}
注意:使用前建议判断对象是否为 null,避免因控件不存在导致脚本报错。
ℹ️ 本回答由 AI 生成,内容仅供参考