【自动化】如何检测页面到顶或到底
【方案一】通过划动前后,判断某一区域色值是否变化。
'这种方案已封状在actioin包内 If Not action.swipeUp() Then '返回false表示划动失败,即到最底部 '到最底部 End If
【方案二】通过划动前后,某一节点的位置是否发生变化。
Sub toTop() '第一步:划动使关注按钮出现(关注按钮位于顶部区域) Dim nodeConfig = fun.config("团购商家主页_关注按钮", "node") Do Dim ret = fun.sendCode("getAllNodes", nodeConfig) If IsNull(ret) Or luaTable.length(ret) = 0 Then action.sendSwipeDown("", 2) Else g.print("关注按钮已出现") Exit Do End If Loop '第二步:继续划动,分析前后关注按钮节点数据是否变化 Dim beforeNode = fun.sendCode("getAllNodes", nodeConfig) '划动前节点 Do action.sendSwipeDown() '执行划动 Dim afterNode = fun.sendCode("getAllNodes", nodeConfig) '划动后节点 If luaTable.eq(beforeNode, afterNode) Then '节点对比 '二个节点一致,说明到顶划不动 Exit Sub End If beforeNode = afterNode Loop End Sub

浙公网安备 33010602011771号