[Wtr-general] Set focus to original window

Alan Jahns ajahns at gmail.com
Mon Dec 4 17:39:50 EST 2006


Thanks for the outline in the pseudocode, I do want to do something better
than just make it sleep, its one of those hurry up and get it to work right
now so bosses are happy, then make it work better afterwards kind of
situations.

Alan

On 12/4/06, Danny R. Faught <faught at tejasconsulting.com> wrote:
>
> On 12/4/2006, "Alan Jahns" <ajahns at gmail.com> wrote:
> >Well thanks a lot, you led me to the fix. It does seem to be a timing
> >problem, I started googling to figure out how to do a loop as you
> suggested
> >and while doing that found the sleep command, so I tried something like:
> >
> >ie2.button(:value, "Sign In").click
> >   # take a nap to wait for first page to load
> >   sleep(25)
>
> I was hoping you wouldn't find that.  :-)  The hacker in me wants to
> point out that using sleeps to synchronize are both too slow and still
> don't technically remove the race condition.
>
> But the engineer in me says, hey, great, that will probably work in most
> or all of the cases you need it for, and the slower it is, the more
> likely it'll work.
>
> You pick which one you want to listen to.  :-)  Here's pseudocode for
> how I would approach it -
>
> ..child window initiates content change in parent window
> found = 0
> for i in 1..10
>   ie.wait
>   if desired content found in parent
>     found = 1
>     break
>   end
> end
> if found == 1
>   hurrah!
>
> -Danny
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20061204/d04844d8/attachment-0001.html 


More information about the Wtr-general mailing list