Using Watir 6.0.3, page object 2.0.0 and Ruby 2.1.9
As per latest watir and page-object changes changed below code to
wait_until(DEFAULT_WAIT_TIME.to_i, 'Login button not found when waiting for the login page to load') do
login_element.visible?
end
to
message = "Login button not found when waiting for the login page to load"
login_element.wait_until(timeout: timeout, message: message, &:visible?)
but getting undefined method 'zero?' for #<Hash:0x4991340> (NoMethodError)error.
however if I get rid of page-object locator shown below Watir 'wait_until'works as expected.
message = "Login button not found when waiting for the login page to load"
browser.button(name: 'login').wait_until(timeout: 10, message: message, &:visible?)
The
Element#wait_untilmethod is defined as:Notice that
timeoutandmessageare normal parameters rather than keyword arguments. As a result, the usage needs to be:That said,
Element#wait_untilis still broken. The way thatObject::Watir::Wait.untilis called will result in a NoMethodError due toobjectbeingnilin the Watir method. Until a fix is released, you can monkey patch Page-Object using (included after yourequire 'page-object'):