RE: [PHP-WIN] Using Inernet Explorer COM object and need to reference popup windows

From: Date: Thu, 16 Jun 2005 20:42:02 +0000
Subject: RE: [PHP-WIN] Using Inernet Explorer COM object and need to reference popup windows
Groups: php.windows 
Request: Send a blank email to php-windows+get-26111@lists.php.net to get a copy of this message
I'm using PHP's COM class to instantiate IE and go through some automated routines (e.g., go to URL, click a couple of links, etc.), for testing purposes on our website. To be more specific, I'm using PHP CLI to do all of this automation. For the most part, I can open the browser, tell it to go to a specific URL, click links, etc, with PHP. In addition, I can verify certain things along the way, like the Window title, content, etc. However, I'm having a little trouble verifying links on the web page that open a pop-up (i.e., target=_new in the href tag). The latter is where I am seeking advice from the newsgroup. Thanks, Dang Nguyen -----Original Message----- From: Paul Menard [mailto:paulmenard1@yahoo.com] Sent: Thursday, June 16, 2005 1:36 PM To: Dang Nguyen; php-windows@lists.php.net Subject: Re: [PHP-WIN] Using Inernet Explorer COM object and need to reference popup windows So I'm reading this and it sounds really interesting and all but I'm also scratching my head asking myself what this popup, IE COM object (client side) discussion has to PHP (server side). (Apologies if this seems rude. Having another Monday today. ;) --- Dang Nguyen <dang.nguyen@docusign.com> wrote: > 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 > >

« previous php.windows (#26111) next »