1

A web application consistently uses this div after user actions. My test scripts have this line. verbatim, all over the place.

@browser.div(:id => 'loading-indicator').wait_while_present

Explicitly including this line everywhere is OK, but ugly and repetitive.

Using wait_until_present with the next element ("foo") after the loading indicator would sometimes work. However, in some cases foo and the loading indicator are present simultaneously, but foo is not visible? until the loading indicator disappears.

Is there a way, perhaps in env.rb, to indicate to watir-webdriver that it should always wait_while this element is present?

1 Answer 1

6

If you want to check for it after every click and page load/reload you can add it to an After Hook

browser.after_hooks.add do |b| 
  b.div(id: 'loading-indicator').wait_while_present
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.