`@element` references an `<iframe>` element that was located in the top frame
(`default_content`) context. If we are switched to this `<iframe>` (or another,
non-top frame) and try to switch to it again, it raises the
StaleElementReferenceError, since `@element` can only be used from the context
it was found in (that is, `default_content`). That's why the rescue, which
switches back and tries again, works.
With nested frames, it's not as simple as switching back to the top
level/`default_content`, we need to walk the same chain of frames, step by
step, to get to the correct context.
It's a bit tricky.
---
Reply to this email directly or view it on GitHub:
https://github.com/watir/watirspec/commit/a763f09b0ff58d050bc4019fe961ed9eac111eae#commitcomment-5060754
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development