-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Accepted 🌱 受理Maintainer may be busy resolving or fixing the labeled issuesMaintainer may be busy resolving or fixing the labeled issuesDelayed ⌛ 延期Issues have been accepted but won't be settled in timeIssues have been accepted but won't be settled in timeFeedback Awaited 🕒 等待反馈Waiting for the feedback from issue creater and issue will be closed if duration is over one monthWaiting for the feedback from issue creater and issue will be closed if duration is over one monthReinforcement ✨ 强化Issues for higher quality of being compatibleIssues for higher quality of being compatible
Description
demo如下:
let yx = className('ImageButton')
.desc('转到上一层级')
.findOne(1000)
log(yx.click())
back()
sleep(4000)
log(yx.click())
这里使用click()来代替了。
背景是:页面切换之后,旧页面的控件,在新页面找不到了,但原来的UiObject对象还能被引用,现在需要一个函数判断这个对象是否还能被找到,再决定是否能用。
实际上,我包装了两个click函数,一个是UiObject.click(),另一个是click(x,y)。第二个函数是-传入控件中心坐标。有时候我使用UiObject对象的click之后,不能确定是否点击成功,又重复使用click(x,y)传入中心坐标再次点击。
但如果click()成功了,页面将会跳转的新页面,再使用click(x,y)点击一次,就多余了,甚至误点触发别的操作。
所以需要一个判断UiObject是否还能被找到的函数,先判断,再决定是否click(x,y)
Metadata
Metadata
Assignees
Labels
Accepted 🌱 受理Maintainer may be busy resolving or fixing the labeled issuesMaintainer may be busy resolving or fixing the labeled issuesDelayed ⌛ 延期Issues have been accepted but won't be settled in timeIssues have been accepted but won't be settled in timeFeedback Awaited 🕒 等待反馈Waiting for the feedback from issue creater and issue will be closed if duration is over one monthWaiting for the feedback from issue creater and issue will be closed if duration is over one monthReinforcement ✨ 强化Issues for higher quality of being compatibleIssues for higher quality of being compatible