I have a problem closely resembling the one posted here, and I do not see any satisfactory answers in this thread:
http://stackoverflow.com/questions/10404789/watir-webdriver-how-to-force-the-click-method-to-wait-for-the-page-to-load-comp That is, I was using watir (1.6.2) and changed to watir-webdriver (0.6.1) after which, all my rspecs performing button.click actions no longer wait until the next page is drawn (not an AJAX page). These buttons have Javascript onclick handlers to ensure the button isn't pressed twice, but aside from that behave like ordinary form submissions. I have worked around the problem in one of two ways, neither of which are acceptable in the long term. I'm seeking a better general solution: 1. If the click just causes the default form submit action, bypass the click and trigger a submit on the form. This is unacceptable because 'submit this form' is not a user action, and I want to test only what the user is doing and what the user can see as a result. 2. Otherwise (in the case where which button on the form changes how the script receiving the click behaves), follow the click with a hard-coded wait of, say, 20 seconds. This is unacceptable because the more tests we add, the more these delays compound, and are fragile in the face of other demands being placed on the system at the time, besides. All of the non-solutions I've seen so far (including all answers to the post linked above) relate to waiting for some predictable change of the contents of the page. But not only do the page changes vary from one case to the next, but I can't even identify some element that I could always count on as a "sentinel" to determine that "yes, we've arrived at the next page". Some button clicks just return me back to the page I was on, looking very much like it did before the click. What I, like the poster of the above stackexchange article, had hoped would be the case is to directly observe that a new page is being visited and wait for it to finish loading, period. No nasty tricks required, like having the application inject a counter into the page so we can check it before and after the click to see if it changed. Does watir-webdriver not provide such a facility? It seemed to one of my colleagues I shared this problem with to be a staggering design flaw in watir-webdriver, and while I wanted to defend the package, as I am quite enamored already of the possibilities it promises, I had no satisfactory answer. Sadly, we'll remain shackled to a less flexible, more cumbersome, and more costly proprietary solution unless I can sell my team on watir-webdriver being a better solution, and this latest issue plaguing my watir tests having led me through a half day excursion in the doc and on the web may be the deal-killer unless I can now come up with a reasonable solution in a timely fashion. So I would be extremely grateful if someone who has been down this road before could provide me with guidance. Thanks, Ben -- 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]
