Re: Using Inernet Explorer COM object and need to reference popup windows
| From: | Louis Solomon [SteelBytes] | Date: | Fri, 17 Jun 2005 04:06:20 +0000 |
| Subject: | Re: Using Inernet Explorer COM object and need to reference popup windows | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26112@lists.php.net to get a copy of this message | ||
you may be better off in
msnews.microsoft.com : microsoft.public.inetsdk.programming.webbrowser_ctl
--
Louis Solomon
www.SteelBytes.com
""Dang Nguyen"" <dang.nguyen@docusign.com> wrote in message
news:1F.4B.20931.E32D1B24@pb1.pair.com...
> 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