Bill, This is really great! I subsequently got things working by going to the objectspace, finding the ie object and then assigning it to an object within the navigation method each time that it got called. But this seems like a better way of doing it. And if it works for the attach method it may work for file_field too (am getting an ole error there as well). I'm reading the gserver rdocs tonight and will try these scripts tomorrow. Thanks for posting this!
John --- Bill Agee <[EMAIL PROTECTED]> wrote: > I also ran into this problem a while back. After > trying the same > options you listed, I wound up working around it by > using Windows task > scheduler to run the scripts that needed the attach > method. It was a > bummer to not be able to manually start the scripts > from a remote > machine whenever I wanted, though. > > A while later, I was introduced to the Ruby gserver > library. A quick > test seems to show that the attach method works fine > when I remotely > start a Watir script using a little gserver-based > server. So, this > might solve the problem for you too. > > Below I've pasted my gserver script. When this is > run, it loops > forever listening on 0.0.0.0 port 10001. So, if you > open a browser on > an external machine and point it at > http://[your-hostname]:10001, it > should execute the serve() method and the > "system('ruby > attach_test.rb')" statement inside it. > > The script expects attach_test.rb in the same dir as > the gserver > script. Also, I suppose you'd need to set up a > Windows firewall > exception if you have it enabled. > > watirserver.rb: > ====================== > # Executes 'attach_test.rb' whenever someone > connects to port 10001 > > require 'gserver' > > class WatirServer < GServer > def initialize(port=10001, host='0.0.0.0') > super(port, host, Float::MAX, $stderr, true) > end > def serve(io) > system('ruby attach_test.rb') > end > end > > server = WatirServer.new > server.start > server.join > ====================== > > > attach_test.rb : > ====================== > require 'watir' > > ie = Watir::IE.new.goto('www.google.com') > ie2 = Watir::IE.attach(:title, /Google/) > ie2.text_field(:name, 'q').set('Ruby') > ie2.button(:name, 'btnG').click > ====================== > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
