Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am planning to automate testing of a 3rd party GUI based application running on MS windows. The Win32::GuiTest module has proven to be very valuable for this task. Unfortunately, I have hit a roadblock with one test. The window in question is of class "Internet Explorer_Server" - as reported by Spy++ and WinSpy. This window contains some html formatted text. Calling getWindowText() api of Win32::GuiTest module on this window does not return the window text.

Has any other perl monk encountered similar issue? If yes, how did you solve it? Any pointers/guidance will be appreciated.

  • Comment on Using Win32::GuiTest with Explorer_Server

Replies are listed 'Best First'.
Re: Using Win32::GuiTest with Explorer_Server
by scmason (Monk) on Jul 15, 2005 at 16:08 UTC
    Hi,

    Calling getWindowText() is only going to return the 'windows text' which is usaully just the title of the window. In a browsers case, this ussually include the title of the web page as well (Look in the upper left corner of your browser window).

    If you want the text that is being displayed, you could always save the file and then read it from your perl script. You could do that by the SendKeys() method, passing in a string like SendKeys("%(fs)").

    This would first send a Control-F, which would invoke the file menu, then a Control-S, which would invoke "Save-As". Then you would have to deal with the resulting dialog as a new window. Just send the keys of where you want to save the file, then open it from your perl script.

    Now, it would be very apparent to the user what you are doing. If you are writing spyware though, I'll wished I had never helped you...

    But I am sure that you are not practicing the dark arts...

    "Never take yourself too seriously, because everyone knows that fat birds dont fly" -FLC
      Hi,

      Thanks for the prompt response. I apologise for not responding sooner. There was a typo in my original mail - I am using WMGetText() method to extract text from the window object and not GetWindowText(). I am not trying to control Internet Explorer (the browser) - for this the "SAMIE" sourcforge project would be most suitable. I have an application that displays lots of messages in a window for operatotrs/users to read and act upon. Using Spy++, I have determined that this display window is of type "Internet Explorer_Server". Unfortunately, the WMGetText() api is not able to extract window text from "Internet Explorer_Server" class.

      The closest reference to my current problem (searching google) is this codeguru page http://www.codeguru.com/Cpp/I-N/internet/instantmessaging/article.php/c6225/. The codeguru example talks of retrieving text from a yahoo messenger chat window. In my case, the application is different but the target window class from which I need to extract text is the same.

      <aside> I assure you that I dont like spyware/virii any better than you do. I am trying to automate some gui tests and it works ok for regular edit windows - but I have run into a roadblock with this "Internet Explorer_server" class of windows. </aside>

Re: Using Win32::GuiTest with Explorer_Server
by flogic (Acolyte) on Jul 15, 2005 at 16:21 UTC
    Perl.com had an article on using Win32::OLE. It covers getting the DOM tree which I would think you can turn back into HTML. However if you're worried about the exact source fed to the brower, you are probably be out of luck. I think IE mangles it.
      Hi,

      I will take a look at the Win32::OLE module and the article. Thanks for the pointer.