Using Inernet Explorer COM object and need to reference popup windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am using PHP 5.0.4 and using Internet Explorer COM object to access a 
website.  From that website, my script clicks on a few links, for testing 
purposes.  A few of the links popup a new browser window, so I need a way to 
verify that the link does open a new popup and also the URL, title, content, 
or something that verifies the popup destination is what I expect it to be.

I've found some material about using com_event_sink and tried implementing 
it, but it seems to hang the browser and the script exceeds the 
max_execution_time. Below is a code snippet:

class IEEventSinker {
      var $terminated = false;
      var $newWindowOpened = false;

      function NewWindow2 ($ppDisp, $Cancel=true) {
            $this->newWindowOpened = true;
            echo "<p>New Window event was fired.";
      }

      function OnQuit() {
            echo "Quit!\n";
            $this->terminated = true;
      }
}

// the sinker that will capture IE events
      $sink =& new IEEventSinker();
      com_event_sink($myIE->ie, $sink, "DWebBrowserEvents2");

      try {
// $myIE is a class that instantiates the IE COM object, and clicklinkIE 
performs the mouseclick on the web page

            $linkResult = $myIE->clicklinkIE($links['name']);
            while($targetIsPopup && !$sink->newWindowOpened) {
                  com_message_pump(4000);
            }

            $myIE->wait_while_busy();
// script continues on


Can someone suggest a way to accomplish what I've described above?  Examples 
would be appreciated.

Thanks in advance,
Dang Nguyen 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux