水豚在同步不等待中查找

Capybara Find Within Synchronize Not Waiting

下面的代码一直循环,我希望 find 在抛出异常和循环迭代之前等待其默认等待时间 2 秒。

user_general.synchronize(10) do
    tab_me.primary_action("Plus").click
    add_edit_item.find('.ready[data-id="pageAddEditItems"]')
end

在 Capybara 中,只有最外层的同步循环在失败时重新运行,您可以在执行以下操作的#synchronize 的源代码中看到这一点

if session.synchronized
  yield  # if we are already in a synchronize loop just run the code
else
  ...   # catch errors and retry until max wait time expires or success
end