Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element.wait_until is broken #408

Closed
pravinrmali opened this issue Dec 30, 2016 · 7 comments
Closed

element.wait_until is broken #408

pravinrmali opened this issue Dec 30, 2016 · 7 comments

Comments

@pravinrmali
Copy link

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?)
@cheezy
Copy link
Owner

cheezy commented Mar 6, 2017

I think this is fixed in watir and working properly in page-object. Please reopen if you think there is still a problem.

@cheezy cheezy closed this as completed Mar 6, 2017
@galinkinlin
Copy link

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?)

@jkotests
Copy link
Collaborator

@galinkinlin , what is the issue you are running into? some_element.when_visible(30) seems to be working for me.

@galinkinlin
Copy link

galinkinlin commented May 22, 2019

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.

@galinkinlin
Copy link

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.

@jkotests
Copy link
Collaborator

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.

@galinkinlin
Copy link

I am doing a simple some_element.when_visible(20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants