> -----Original Message----- > Subject: [Wtr-general] Controlling threads & testing speed
> What tricks are available for timing threads and controlling > the speed of WATIR? How can we make sure a thread has ended? > > The basic concern is that the WATIR script will work, then it > may not work, and eventually it will work again without any > modification to the code or application. These scripts > involve modals and pop ups. I believe it is a timing issue, > but I am not certain. > > Has anyone else experienced this type of behavior? > [...snip...] I too initially had some problems with timing issues in my popup-dismissing threads. But since then I've had success using sleep() mixed in with creation of threads, as in the example below. Since doing this I've had no further problems with timing issues and simple popup dismissing tasks (knock wood): ============================================= def navigate (address) req01 = Thread.new { goto(address) } # wait a sec for the 'entering HTTPS' IE prompt to appear: sleep(1) # dismiss first IE prompt: req02 = Thread.new { btnclk('Security Alert', 'OK') } # wait for the SSL y/n/cancel prompt to appear: sleep(1) # another button click to dismiss the SSL cert prompt: req03 = Thread.new { btnclk('Security Alert', 'Yes') } # wait for all threads to complete before continuing: req01.join req02.join req03.join end ============================================= (The 'btnclk' method shown above is just a wrapper around an autoit-like DLL I'm using to dismiss windows.) Thanks Bill _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general