Closed pravinrmali closed 7 years ago
I think this is fixed in watir and working properly in page-object. Please reopen if you think there is still a problem.
I know it's been a while, but, pretty much the same issue:
ruby 2.5.5, page-object 2.2.6, watir 6.16.5.
I call some_element.when_visible(30)
. That's aliased as when_present, which calls:
element.wait_until(timeout: timeout, message: "Element not present in #{timeout} seconds", &:present?)
When debugging into element.wait_until (line 169 of element.rb), the arguments look like this:
timeout: { message: Element not present in 30 seconds, timeout: 30}, message: nil
It seems to me that the call to element.wait_until shouldn't pass a hash, but just be:
element.wait_until(timeout, "Element not present in #{timeout} seconds", &:present?)
@galinkinlin , what is the issue you are running into? some_element.when_visible(30)
seems to be working for me.
Specifically, I am getting the error:
NoMethodError: undefined method zero?' for {:timeout=>30, :message=>"Element not present in 30 seconds"}:Hash
However, now that I Iook more closely, I can see that this is only happening for custom elements I've defined, and not everywhere. I must be doing something funky. We were stuck on ruby 1.9.3 until recently, and upgrading everything at once has been quite the chore.
Nevermind, it's even weirder than that. It works just fine when I run it through Intellij's "Evaluate" console, but not when it runs normally. Whatever is going on has got to be my fault.
Keep in mind that Page-Object's #wait_until method's arguments are not yet in sync with Watir's - see #471. Page-Object only accepts the positional arguments, it does not yet support keywords or a Hash.
I am doing a simple some_element.when_visible(20)
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
to
but getting (NoMethodError) `error.
undefined method
zero?' for #however if I get rid of page-object locator shown below Watir 'wait_until'works as expected.