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#exists doesn't relocate element when it becomes stale #810
Comments
Yeah, I see your point and there are a bunch of related issues here. I do want the notion of a Watir Element to be "whatever exists at the location provided". BUT. For performance reasons we cache the element and don't always re-look it up. AND for consistency reasons we call a referenced element dead. Your expectation here is that after the DOM changes, the first time you call It probably depends on the actual use case you have and not this easily reproducible issue as to how best to approach it. You might be looking for |
Hmmm, maybe calling |
To be honest, my assumption was that But that would prevent the use case to check that the first of elements becomes removed (it could be checked by checking length of element collection). |
Ok, just realized that this should be part of the |
Thanks for bringing this inconsistency to my attention. Not sure how Nerodia is doing this, but for 7.0 we'll go through and remove all deprecations. I'll close this issue since we'll be tracking it separately. Expected behavior is: br = Watir::Browser.new
br.goto("http://jsfiddle.net/sbhnru40/show")
li = br.iframe.li
br.iframe.lis.size # => 2
li.exists? # => true
# this will time out because there is always an li in the iframe
# li.wait_while(&:exists?)
sleep 2
li.exists? # => true
br.iframe.lis.size # => 1
br.quit |
Expected Behavior -
In some circumstances user may assume that Watir relocates stale element when it doesn't.
I thought that:
may wait for page to have no elements with class "x". But it actually waits for the first element with class "x" to disappear.
I'd like to ask if there's a reason behind current behavior of not relocating stale element.
The user currently should wait until list of elements becomes empty in this example case.
Actual Behavior -
If element is stale and
exists
is called, the method doesn't relocate element to check if there is another element that corresponds to locator.Steps to reproduce -
The text was updated successfully, but these errors were encountered: