What would you suggest for running mutiple threads, BUT each thread using
different variables. I've 'stolen' the following code from Brett (thanks!)
which does exactly as expected, BUT how would I, for instance, search for a
different value (instead of 'pickaxe') in each thread?
> 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.html
> ie.close
> end
>
> threads = []
> 3.times do
> threads << Thread.new {test_google}
> end
> threads.each {|x| x.join}
Could I pass some arguments to +Thread.new(args)+, or should I simply create 3
threads as such:
> a = Thread.new { yada yada }
> b = Thread.new { yada yada }
> c = Thread.new { yada yada }
I also don't quite understand why the *threads.each {|x| x.join}* command
exists ?
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general