CaptainBeardsEyesBeard Posted February 10, 2020 Share Posted February 10, 2020 (edited) 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? expandcollapse popup--> 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 February 10, 2020 by CaptainBeardsEyesBeard Link to comment Share on other sites More sharing options...
Danp2 Posted February 10, 2020 Share Posted February 10, 2020 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted February 10, 2020 Author Share Posted February 10, 2020 (edited) 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 February 10, 2020 by CaptainBeardsEyesBeard Link to comment Share on other sites More sharing options...
Danp2 Posted February 10, 2020 Share Posted February 10, 2020 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" Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted February 11, 2020 Author Share Posted February 11, 2020 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? Link to comment Share on other sites More sharing options...
Danp2 Posted February 11, 2020 Share Posted February 11, 2020 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 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted February 11, 2020 Author Share Posted February 11, 2020 Cheers good tip! So is there a way to attach this IE instance some other way? Link to comment Share on other sites More sharing options...
Nine Posted February 11, 2020 Share Posted February 11, 2020 Read help file of _IEAttach, there is multiple ways to attach to a IE instance. Try with handle ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now