Watir::WaitWithRefresh extends Watir to include methods that will refresh the page until or while an element is present or a block is true.
gem install 'watir-wait_with_refresh'
The wait methods can be added after requiring Watir:
require 'watir' #or 'watir-classic' or 'watir-webdriver'
require 'watir/wait_with_refresh'
Refresh the page until an element is present:
element.refresh_until_present
Refresh the page while an element is present:
element.refresh_while_present
Do something after refreshing the page makes the element present:
element.when_present_after_refresh.text
Refresh the page until a block evaluates as true:
browser.refresh_until{ browser.div.present? }
Refresh the page while a block evaluates as true:
browser.refresh_while{ browser.div.present? }
A timeout can also be specified for each of the methods:
element.refresh_until_present(5)