Jump to content
CaptainBeardsEyesBeard

Unable to attach to an IE instance

Recommended Posts

Am I doing something wrong here? 

After doing my testing in one window I then open a new instance of IE using IECreate 

$ApplicationWindow = "Client Inception | Confirmation - Internet Explorer"

Local  $oIE2 = _IECreate($ConfirmationURL)
 $oIE2 = _IEAttach($ApplicationWindow, "$ConfirmationURL")
 if @error then
    ConsoleWrite(@CRLF & "Can't attach $oIE2")
 EndIf

_IELoadWait($oIE2)


  Sleep(10000)
if  WinWait($ApplicationWindow, "", 10) then
   Send("{LWINDOWN}")
   Sleep(2000)
   Send("{Up}")
   Sleep(2000)
   Send("{LWINUP}")
EndIf

In my console I then get this which means it's hitting the error for IEAttach 

 

What is the correct way to open a new window?

 

--> IE.au3 T3.0-2 Warning from function _IELoadWait, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Error from function _IEAttach, $_IESTATUS_InvalidValue (Invalid Mode Specified)

Can't attach $oIE2--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType

Error trying to _IEGetObjByID on  following web ID: Client_WhyConfidentClientCanPay--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType

Error trying to _IEGetObjByID on  following web ID: $Client_SourceOfFundsID
Test Automation random no: 5363$ObjID equals the following: 0
0Isn't an object
Automation street rand no: 4110$ObjID equals the following: 0
0Isn't an object
Line 2 automation rand no: 1598$ObjID equals the following: 0
0Isn't an object
London rand no:6568$ObjID equals the following: 0
0Isn't an object
State rand no:3001$ObjID equals the following: 0
0Isn't an object
123456$ObjID equals the following: 0
0Isn't an object
$ObjID equals the following: 0
0Isn't an object
614052$ObjID equals the following: 0
0Isn't an object
$ObjID equals the following: 0
0Isn't an object
$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_WhoIntroducedUS. Random no: 8212$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_IndividualsWithSignificantHoldings Random no: 620$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_ClientInstructions Random no: 640$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_TransactionValues Random no: 2473$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_SourceOfFunds Random no: 5361$ObjID equals the following: 0
0Isn't an object
Testing field ID Client_WhyConfidentClientCanPay Random no: 1036$ObjID equals the following: 0
0Isn't an object--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType

Testing field ID Client_WhyNotHadFaceToFace Random no: 440$ObjID equals the following: 0
0Isn't an object>Exit code: 0    Time: 459.6

 

Edited by CaptainBeardsEyesBeard

Share this post


Link to post
Share on other sites
4 minutes ago, CaptainBeardsEyesBeard said:

$oIE2 = _IEAttach($ApplicationWindow, "$ConfirmationURL")

This line is definitely wrong. I see two issues --

  • You don't want your variable name in quotes (unless you want it treated as a literal string 😄)
  • The 2nd parameter of _IEAttach is used to specify the attachment mode. Unsure why you would choose to pass a URL here.

Share this post


Link to post
Share on other sites
14 minutes ago, Danp2 said:

This line is definitely wrong. I see two issues --

  • You don't want your variable name in quotes (unless you want it treated as a literal string 😄)
  • The 2nd parameter of _IEAttach is used to specify the attachment mode. Unsure why you would choose to pass a URL here.

Yes apologies that's where I was trying to try different switches to see if I could get it to work 

I just re-ran with the following 

$ApplicationWindow = "Client Inception | Confirmation - Internet Explorer"

Local  $oIE2 = _IECreate($ConfirmationURL, 0, 1,1, 1)
 $oIE2 = _IEAttach($ApplicationWindow)
 if @error then
    ConsoleWrite(@CRLF & "Can't attach $oIE2")
 EndIf

_IELoadWait($oIE2)


  Sleep(10000)
if  WinWait($ApplicationWindow, "", 10) then
   Send("{LWINDOWN}")
   Sleep(2000)
   Send("{Up}")
   Sleep(2000)
   Send("{LWINUP}")
EndIf

And got the same failure at the if statement

Can't attach $oIE2--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch

Can't attach $oIE2--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType

 

Edited by CaptainBeardsEyesBeard

Share this post


Link to post
Share on other sites
18 hours ago, Danp2 said:

A couple of things to try --

  • You could change the flag on your _IECreate so that it doesn't wait for the page to load
  • _IEAttach will work with a partial title, so you may want to shorten it to just "Client Inception"

Thanks I did try this 

$ApplicationWindow = "Client Inception"

Local  $oIE2 = _IECreate($ConfirmationURL, 1, 1,0, 1)
 $oIE2 = _IEAttach($ApplicationWindow)
 if @error then
    ConsoleWrite(@CRLF & "Can't attach $oIE2")
 EndIf

_IELoadWait($oIE2)

I still get this however 

Can't attach $oIE2--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType

Any idea on what I can do? 

Share this post


Link to post
Share on other sites

Yes... your If statement catches an error condition, which you then perform a ConsoleWrite to acknowledge. At this point, you don't have a valid IE reference, yet you continue to execute the rest of the script as if you do. Easiest solution is to add an Exit statement to stop the script when the error is detected.

P.S. I recommend that you change your coding style for ConsoleWrite to put the @CRLF at the end instead of the beginning. That would result is more understandable output, ie --

Can't attach $oIE2
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType

😉

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...