I keep coming back to the idea of controlling multiple Ruby/Watir
scripts with Perl, because Perl can launch each script in its own
Windows process, and doesn't have to deal with threads and
thread-safety. system(1,"foo") just rocks, and until Ruby gets one, I
really like using Perl's. I do it to handle logon popups, but if you
don't need to, get rid of the GuiTest/SendKeys part:
use warnings;
use strict;
use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys );
my $x = 0;
system (1, "ruby c:/myscript.rb");
while (1) { #INFINITE LOOP
sleep 2; #CHECK FOR NEW WINDOW EVERY 2 SEC
my @windows = FindWindowLike(0, "^Logon Right Here");
for (@windows) {
SetForegroundWindow($_); #BRING THE RIGHT WINDOW IN FOCUS JUST IN CASE
SendKeys("user");
SendKeys("{TAB}");
SendKeys("password");
SendKeys("{ENTER}");
$x = 1;
}
exit if $x == 1;
}
On 5/10/06, John Fitisoff <[EMAIL PROTECTED]> wrote:
> Help! I'm new to Watir, and am trying to get my
> company to use it, but am running into a problem. I'm
> trying to run multiple, independent windows without
> having them interfere with each other. I've tried a
> few different things:
>
> -ie, ie1, ie2 etc... (no globals)
>
> -Using winclicker to launch an existing HTML page and
> then attaching to it.
>
> -Looking at the concurrent_tests example.
>
> The reason that I'm doing this is I need to fit this
> in with what the build engineer is already doing. To
> make him happy, I need to deliver a suite of tests
> that can be run against different servers on the
> network, and at least some of the time these tests are
> going to be run simultaneously on a system that will
> host the test. In some cases, two different test
> suites would be running at the same time.
>
> I don't think I can use the concurrent example because
> these tests won't be run at exactly the same time and
> I also need to pass the test suite a base url for the
> server I'm testing against.
>
> No matter what I've tried, the instances end up
> interfering with each other and some of the tests fail
> with errors. Is there some way to work around this?
> I'm not the most technical person in the world but
> this is a really cool automation tool and I'd like to
> get it adopted here for UI testing. I'm not sure if
> I'll be able to do that if I can't figure out how to
> get past this.
>
> Please don't make me go back to HTML Unit. :-)
>
> Thanks
>
> John
>
>
>
>
>
>
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.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