[Wtr-general] Concurrent Threads and different variables in each thread

marekj marekj.com at gmail.com
Thu Jul 12 01:56:48 EDT 2007


if you don't join the threads the execution will stop when program exists.


On 7/11/07, Jason <forum-watir-users at openqa.org> wrote:
>
> Ahhh... maybe, just MAYBE, I should try something before I give up and
> post.
>
> This appeared to work:
>
> > require 'thread'
> > require 'watir'
> >
> > @var1='pickaxe'
> > @var2='axepick'
> > @var3='pckexai'
> >
> > def test_google(varvar)
> >  ie = Watir::IE.start('http://www.google.com')
> >  ie.text_field(:name, "q").set(varvar)
> >  ie.button(:value, "Google Search").click
> >  ie.html
> >  ie.close
> > end
> >
> > a=Thread.new {test_google(@var1)}
> > b=Thread.new {test_google(@var2)}
> > c=Thread.new {test_google(@var3)}
> > a.join
> > b.join
> > c.join
>
> It's not pretty, and if I wanted 5 or 20 threads it would mean writing
> these lines of code 10 or 40 times.  Must be a cleaner way?
> _______________________________________________
> 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/20070712/d033f59f/attachment.html 


More information about the Wtr-general mailing list