On Aug 29, 6:47 pm, JMI <jurek.michal...@bluewin.ch> wrote: > > Anyway, i looked at the code and saw that everything that can be done > > is already done. > > I am not so pessimistic.
Thanks for not being! Your letter made me to look into it once again and this time i paid more attention to code execution points and noticed that there was indeed a bottleneck. In locator.rb in FrameLocator there were these lines: frames = @container.document.frames @container.document.getElementsByTagName(tag).each do |ole_object| @container.document went up in the @container's chain calling assert_exists each time so it was done quite many times as you said. I've now added a cache for @container.document during the time of locating the element which speeds up your example in a magnitude of 10 times or more and the cache will be invalidated as soon as the element has been located so there's not much of a danger of the cache being out of sync. The fix is in this commit (there's also some other refactorings involved) https://github.com/bret/watir/commit/7ba7272b258005b0711fad61a7669632b05151e8 The lines you should be interested in are 6-8 and 118, 120 in locator.rb. Try it out and let me know of your results. > 2) For cases with no frames: Each time when you interact with a different > element (ie., with different locators), the cache changes. So to reproduce > your scenario I should do something like that: > - set my_text_field to a value > - wait till my_text_field is removed from the DOM (without Watir interacting > with any other element, as interacting would change the cache) > - set again my_text_field to a value (or do something else to my_text_field) > I can hardly imagine a need for such a test scenario in real life. It is quite possible in today's web 2.0 applications where DOM elements are created and removed all the time by JavaScript so i wouldn't be so sure that this is not a real life scenario. > > 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. > > No offence! I have already said it is not me who created the application! I'm still not changing my opinion on that thing. If the application is not done by you then maybe you can talk to the persons who did that? If i'd have to test an application like that i'd really consider changing my employer or projects :) Just a hint that life shouldn't be too hard. Again, thanks for not giving up on this problem which (hopefully) lead to the fix :) > Jurek Jarmo -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com