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

Using GuiTest with OLE automation

Expand Messages
  • Dan Neubecker
    I am trying to use this module with a script I have written for test Internet Explorer, in which I have control of IE using the OLE objects for Explorer. but I
    Message 1 of 3 , Feb 4, 2004
    • 0 Attachment
      I am trying to use this module with a script I have written for test Internet Explorer, in which I have control of IE using the OLE objects for Explorer.
      but I find that when I try to use the SendKeys method for some reason I can't seem to get it to work unless I free my control of
      Internet Explorer before I call the method.
      Is there anyway I can maintain control of Internet Explorer while using the Sendkeys method?

      Here is a sample of what I am trying to do the SendKeys here does not actually make anything show in the text field on the web page
      that has control by default

      my $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer.Application\n";
      Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
      $IE->Navigate($URL);
      SendKeys( 1234);
      SendKeys("~");

      any help is greatly appreciated.
      Thanks
      Dan
    • alcam_cs
      ... Internet Explorer, in which I have control of IE using the OLE objects for Explorer. ... reason I can t seem to get it to work unless I free my control of
      Message 2 of 3 , Feb 18, 2004
      • 0 Attachment
        --- In perlguitest@yahoogroups.com, "Dan Neubecker" <dneubecker@p...>
        wrote:
        >
        > I am trying to use this module with a script I have written for test
        Internet Explorer, in which I have control of IE using the OLE objects
        for Explorer.
        > but I find that when I try to use the SendKeys method for some
        reason I can't seem to get it to work unless I free my control of
        > Internet Explorer before I call the method.
        > Is there anyway I can maintain control of Internet Explorer while
        using the Sendkeys method?
        >
        > Here is a sample of what I am trying to do the SendKeys here does
        not actually make anything show in the text field on the web page
        > that has control by default
        >
        > my $IE = Win32::OLE->new("InternetExplorer.Application") || die
        "Could not start Internet Explorer.Application\n";
        > Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
        > $IE->Navigate($URL);
        > SendKeys( 1234);
        > SendKeys("~");
        >
        > any help is greatly appreciated.
        > Thanks
        > Dan

        I believe the problem is that the page hasn't finished loading before
        your sendkeys fires. I made the browser visible and added a wait into
        the process -- now it works.
        #*****
        use Win32::GuiTest qw(SendKeys);
        use Win32::OLE qw(in with);

        my $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could
        not start Internet Explorer.Application\n";

        Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
        my $URL = "www.yahoo.com";
        $IE->{Visible} = 1; # now you see me
        $IE->Navigate($URL);
        while ($IE->Busy) {sleep(1)}; # waits for the page to completely
        load
        SendKeys( 1234);
        SendKeys("~");
      • Dan Neubecker
        This works, thanks. I just have another question, How can I verify that a Java Applet is completely loaded in IE? So that I can make sure I wait long enough
        Message 3 of 3 , Feb 19, 2004
        • 0 Attachment
          This works, thanks.

          I just have another question, How can I verify that a Java Applet is completely loaded in IE?
          So that I can make sure I wait long enough before using SendKeys with that.

          -----Original Message-----
          From: alcam_cs [mailto:alcam_cs@...]
          Sent: Wednesday, February 18, 2004 11:07 AM
          To: perlguitest@yahoogroups.com
          Subject: [perlguitest] Re: Using GuiTest with OLE automation


          --- In perlguitest@yahoogroups.com, "Dan Neubecker" <dneubecker@p...>
          wrote:
          >
          > I am trying to use this module with a script I have written for test
          Internet Explorer, in which I have control of IE using the OLE objects
          for Explorer.
          > but I find that when I try to use the SendKeys method for some
          reason I can't seem to get it to work unless I free my control of
          > Internet Explorer before I call the method.
          > Is there anyway I can maintain control of Internet Explorer while
          using the Sendkeys method?
          >
          > Here is a sample of what I am trying to do the SendKeys here does
          not actually make anything show in the text field on the web page
          > that has control by default
          >
          > my $IE = Win32::OLE->new("InternetExplorer.Application") || die
          "Could not start Internet Explorer.Application\n";
          > Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
          > $IE->Navigate($URL);
          > SendKeys( 1234);
          > SendKeys("~");
          >
          > any help is greatly appreciated.
          > Thanks
          > Dan

          I believe the problem is that the page hasn't finished loading before
          your sendkeys fires. I made the browser visible and added a wait into
          the process -- now it works.
          #*****
          use Win32::GuiTest qw(SendKeys);
          use Win32::OLE qw(in with);

          my $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could
          not start Internet Explorer.Application\n";

          Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2");
          my $URL = "www.yahoo.com";
          $IE->{Visible} = 1; # now you see me
          $IE->Navigate($URL);
          while ($IE->Busy) {sleep(1)}; # waits for the page to completely
          load
          SendKeys( 1234);
          SendKeys("~");




          Yahoo! Groups Links
        Your message has been successfully submitted and would be delivered to recipients shortly.