in reply to Re^2: Win32::IEAutomation and existing IE session
in thread Win32::IEAutomation and existing IE session

Hi PMs,

I too am trying to reuse an IE session but have no success with this:

use IeExisting; my $ie = IeExisting->new( visible => 1, maximize => 1, warnings => 1); $ie->gotoURL('http://www.google.com');

This starts up a new IE window rather than finding/connecting to existing session.

I confirmed it is using the IeExisting constructor (by commenting out the line with "->new" from IeExisting, but then I get an error "Could not start Internet Explorer Application through OLE" when trying to connect to an existing session

Or am I doing something wrong?

Suggestions and comments welcome.

I'm using IE7 on XP.

Thanks...

Replies are listed 'Best First'.
Re^4: Win32::IEAutomation and existing IE session
by Anonymous Monk on Apr 06, 2010 at 06:45 UTC
    Change the error message to include $^E or Win32::OLE::LastError()

      Many thanks for the suggestion - Here is the new error response.

      If I start IE either with the original program or manually, then comment out the '->new' constructor in IeExisting like this:

      $self->{agent} = Win32::OLE->GetActiveObject('InternetExplorer.Application') #|| Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer Application through OLE +$^E\n";

      The response becomes:

      Could not start Internet Explorer Application through OLE The requested lookup key was not found in any active activation context

      If I don't comment it out it starts a new window with no error...

      Hmmm...

      IE version 7.0.5730.13 Build 75730