Okay, i have looked into this issue now. I've set a breakpoint just
before the #text_field invocation and didn't see as many invocations
as you did (didn't count them, but it was something in the lines of ~5
times). I don't understand where did you get that number 1536.
Anyway, i looked at the code and saw that everything that can be done
is already done. All caches are dangerous if not implemented properly
and your patch breaks the point of assert_exists:
1) the element is located at the first place
2) the element is removed from the DOM, e.g. assert_exists should fail
3) your patch returns the previously located element, e.g. the
assert_exists doesn't fail
Also, this makes #exists? also return "true" although it should return
"false".
In conclusion, i'd still say that the application which uses 7 nested
(!!!!) frames is really badly made and should be rewritten anyway. No
offence. So, it is just one really bad corner-case where it's slower
than usual, but unfortunately i don't see any good solution at this
moment how to solve it for everyone. I guess you can use #value for
that specific case, but i'm pretty sure you will also have slower
invocations with other methods.
Also, one solution would be to open that frame directly in your
browser instead of accessing it through all the other 6 frames.
Something like this with this concrete example or just create some
helper module, which could generate the correct url:
my_frame=ie.frame(:name, '7.6').frame(:name, '6.5').frame(:name,
'5.4').frame(:name, '4.3').frame(:name, '3.2').frame(:name,
'2.1').frame(:name, '1.0')
ie.goto ie.url.gsub(/\d+\.html$/, my_frame.src)
ie.text_field(:name, 'edit_box').set('123456789')
Jarmo
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]