Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚开始使用葫芦,在过去的几个月里和 Capybara 一起工作。
当按钮处于弹出窗口或打开选项卡时,我似乎无法牢牢锁定按钮。
有时单次触摸效果很好,有时需要两次触摸,有时是 x,y 坐标而不是名称,有时以上都不是。
使用 capybara,wait 和 delay 在缓解这种情况方面取得了巨大的成功。葫芦没有这样的运气。
有没有人知道如何提高按下按钮的成功率?
问题可能是当您尝试按下按钮时该按钮尚未出现在屏幕上。
最安全的做法是找出按钮的 id,然后执行以下操作:
performAction('wait_for_view_by_id', button_id) performAction('press', 'button_id')
或更高级别:
I wait for the view with id "button_id" to appear I press "button_id"