Loading ...
Sorry, an error occurred while loading the content.

Help with IE windows and GuiTest

Expand Messages
  • rqbanerjee
    Hello, I am having some problems with GuiTest on a windows 2000 box and Internet Explorer. I am trying to do a simple task: go to Internet Explorer and
    Message 1 of 2 , May 10, 2004
    • 0 Attachment
      Hello,
      I am having some problems with GuiTest on a windows 2000 box and
      Internet Explorer.

      I am trying to do a simple task: go to "Internet Explorer" and
      SendKeys(...).

      Whatever I do, i cannot get IE to become the active window. I have
      been reading all day, i bet that this is a simple problem.

      My code goes just like this:

      my @windows = FindWindowLike(undef, "^Internet", undef);
      for (@windows) {
      print "$_>\t'", GetWindowText($_), "'\n";
      SetForegroundWindow($_);
      SendKeys("%OFwww.cisco.com~");
      }

      It finds Internet Explorer windows, but double the amount that are
      running. If i have 1 instance running, the script will find 2. If i
      have 2 instances, it will find 4, and so on.

      Then, "setforegroundwindow" just doesn't do anything. SendKeys works
      properly. I have tried using ALT-TAB to manually set the focus, while
      my script is running, and the keys get sent through just fine.

      Any ideas for me on this? Thank you,
      Rajat
    • Dennis K. Paulsen
      You might want to try something like: my @windows = FindWindowLike(0, Internet Explorer$ , undef); If it does find multiple windows and there aren t multiple
      Message 2 of 2 , Jun 1, 2004
      • 0 Attachment
        You might want to try something like:
        my @windows = FindWindowLike(0, "Internet Explorer$", undef);

        If it does find multiple windows and there aren't multiple instances
        running, you'll also want to use the third parameter of
        FindWindowLike and narrow down the search by window class name. You
        can get the window class name using GetClassName() or WinSpy++.
        Once the top-level Internet Explorer window is found,
        SetForegroundWindow should work accordingly.


        Regards.


        --- In perlguitest@yahoogroups.com, "rqbanerjee" <rajbaner@c...>
        wrote:
        > Hello,
        > I am having some problems with GuiTest on a windows 2000 box and
        > Internet Explorer.
        >
        > I am trying to do a simple task: go to "Internet Explorer" and
        > SendKeys(...).
        >
        > Whatever I do, i cannot get IE to become the active window. I have
        > been reading all day, i bet that this is a simple problem.
        >
        > My code goes just like this:
        >
        > my @windows = FindWindowLike(undef, "^Internet", undef);
        > for (@windows) {
        > print "$_>\t'", GetWindowText($_), "'\n";
        > SetForegroundWindow($_);
        > SendKeys("%OFwww.cisco.com~");
        > }
        >
        > It finds Internet Explorer windows, but double the amount that are
        > running. If i have 1 instance running, the script will find 2. If i
        > have 2 instances, it will find 4, and so on.
        >
        > Then, "setforegroundwindow" just doesn't do anything. SendKeys
        works
        > properly. I have tried using ALT-TAB to manually set the focus,
        while
        > my script is running, and the keys get sent through just fine.
        >
        > Any ideas for me on this? Thank you,
        > Rajat
      Your message has been successfully submitted and would be delivered to recipients shortly.