That did it. Both of your suggestions worked fine - either wrapping the ie.text_field and ie.button statements in "unless ie.test == '' then" or in "begin,rescue,end" bypassed this problem. Perhaps one of these could be included in the example - demonstrating the need to test for the existence of an object before trying to use it :-)
Thank you - I appreciate your help - I'm new to ruby, watir, and windows (my native tongue is perl - my native land is unix) and don't yet have a feel for what's "normal" Also On Fri, 05 Aug 2005 10:40:20 -0500 Bret Pettichord <[EMAIL PROTECTED]> wrote: > I have now been able to reproduce this problem. > > When it occurs, there is blank IE window. It saws > 'http://www.google.com/' in the address bar, but the page is blank, > and it is not loading. A refresh corrects the problem. This is > different from what i thought might be happening (adding waits and > sleeps won't correct this). > > I'm guessing that this is a multithreading bug in IE itself, that > shows up more often on machines with limited resources (like yours). > > I don't really see a way to change Watir itself to avoid this > problem. To some degree it doesn't look like an automation bug. In > other words -- if you manually ran several browsers this fast, i > suspect you'd see the same problem. > > I could advise you how to workaround the problem in specific cases. > In this situation ie.text == '', so you add a check to detect this > situation and retry in your script (or trap the error and ignore it). > > Bret > > At 09:25 AM 8/5/2005, Warren Pollans wrote: > >I put the script in a loop to run 20 times - typically, there'll be 2 > >errors out of twenty. Could someone else try this: > > > >for %i in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) do > >ruby concurrent_search.rb > > > >I put in a "sleep 1" between the ie.start and the ie.test_field and > >still got failures. > > > >A few other things that didn't work (I'm just fishing): > >- putting ie.wait after the the ie.start > >- replace ie.start with ie = IE.new; ie.goto > > > >Changing the number of threads to 1 did work -->> no errors > >Changing the number of threads to 2 did NOT work > > > >I'm using the current stable version of ruby (1.8.2-14, I believe) > >and the watir 1.4. I'm running win2k (service pack 4) on an old 730 > >MHz Gateway with 256 Mb memory > > > > > >On Thu, 04 Aug 2005 17:08:36 -0500 > >Bret Pettichord <[EMAIL PROTECTED]> wrote: > > > > > My guess is that this is a timing issue of some sort and > > > ultimately a bug (race condition) in watir. > > > > > > One thing you can do is put small sleep statements in there. > > > > > > For example put a "sleep 0.1" right before the failing line and > > > then see if you can reproduce the problem. If not, that proves it > > > is a race condition. (We still would need to figure out exactly > > > where the problem is, however.) > > > > > > Bret > > > > > > At 01:42 PM 8/4/2005, Warren Pollans wrote: > > > >OK, I was wrong, the behavior is intermittent. Sometimes it > > > >works and sometimes it doesn't :-( Any suggestions about how > > > >to track this down? > > > > > > > >On Thu, 4 Aug 2005 14:35:36 -0400 > > > >Warren Pollans <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hmmm, I get the error if there's no browser window open at the > > > > > start. If a browser window is already open, it runs without > > > > > error. Is this the expected behavior? > > > > > > > > > > > > > > > > > > > > On Thu, 04 Aug 2005 12:03:00 -0600 > > > > > Paul Rogers <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > Well, it works for me ;-) > > > > > > > > > > > > The error is that watir couldn't find the text field where > > > > > > you enter the search term. > > > > > > I live in canada, and I always get redirected to google.ca, > > > > > > so maybe something similar is happening for you and the > > > > > > search box has a different name... > > > > > > Other than that I cant really help... > > > > > > > > > > > > -----Original Message----- > > > > > > From: [EMAIL PROTECTED] > > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > > > > Warren Pollans Sent: 04 August 2005 11:39 > > > > > > To: [email protected] > > > > > > Subject: [Wtr-general] example/concurrent_search error > > > > > > > > > > > > > > > > > > Hello, > > > > > > > > > > > > Sorry, if this is obvious - I'm new to ruby, watir, and > > > > > > windows > > > > > > - I'm coming from perl on unix. > > > > > > > > > > > > What have I missed here? I ran the example > > > > > > concurrent_search test and got the following: > > > > > > > > > > > > > > > > > > C:\watir_bonus\examples>ruby concurrent_search.rb > > > > > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1939:in > > > > > > `assert_exists': Unable to locate object, using name and q > > > > > > (Watir::Exception::UnknownObjectException) from > > > > > > concurrent_search.rb:18:in `join' from > > > > > > concurrent_search.rb:18 from concurrent_search.rb:18:in > > > > > > `each' from concurrent_search.rb:18 > > > > > > > > > > > > > > > > > > C:\watir_bonus\examples>more concurrent_search.rb > > > > > > # demonstrate ability to run multiple tests concurrently > > > > > > > > > > > > require 'thread' > > > > > > require 'watir' > > > > > > > > > > > > def test_google > > > > > > ie = Watir::IE.start('http://www.google.com') > > > > > > ie.text_field(:name, "q").set("pickaxe") > > > > > > ie.button(:value, "Google Search").click > > > > > > ie.close > > > > > > end > > > > > > > > > > > > # run the same test three times concurrently in separate > > > > > > browsers threads = [] 3.times do > > > > > > threads << Thread.new {test_google} > > > > > > end > > > > > > threads.each {|x| x.join} > > > > > > _______________________________________________ > > > > > > Wtr-general mailing list > > > > > > [email protected] > > > > > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > > > > > > > > _______________________________________________ > > > > > > Wtr-general mailing list > > > > > > [email protected] > > > > > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > _______________________________________________ > > > > > Wtr-general mailing list > > > > > [email protected] > > > > > http://rubyforge.org/mailman/listinfo/wtr-general > > > >_______________________________________________ > > > >Wtr-general mailing list > > > >[email protected] > > > >http://rubyforge.org/mailman/listinfo/wtr-general > > > > > > _____________________ > > > Bret Pettichord > > > www.pettichord.com > > > > > > _______________________________________________ > > > Wtr-general mailing list > > > [email protected] > > > http://rubyforge.org/mailman/listinfo/wtr-general > >_______________________________________________ > >Wtr-general mailing list > >[email protected] > >http://rubyforge.org/mailman/listinfo/wtr-general > > _____________________ > Bret Pettichord > www.pettichord.com > > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
