Jump to content
CaptainBeardsEyesBeard

Comm Error: Help with an error Message

Recommended Posts

Hey i get this in my console 

 

Starting to attempt to click 2nd next buttonStarting for loop for 2nd next button

Starting for loop for dropdown--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (Client_WhoIntroducedUS)
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType

$ObjID equals the following: "H:\Quality Assurance\GenericFunctions\GenericFunctions.au3" (246) : ==> The requested action with this object has failed.:
ConsoleWrite(@CRLF  & "Testing expected object: " & $ObjExpected & " .Against ObjID.Value: " & $ObjID.Value )
ConsoleWrite(@CRLF  & "Testing expected object: " & $ObjExpected & " .Against ObjID.Value: " & $ObjID^ ERROR

Edit: Ignore this bit as the actual error point is in the 2nd post below this And if I double click the yellow error line it takes me to the attached picture of code 1.png.edb41448e12ac8d9333b5b6c50617307.png

 

The full code being here

;/****************************Due Digilgence Assesement Screen***************************************/
Sleep(8000)
_IELoadWait($oIE)

;set dropdown
ConsoleWrite(@CRLF & "Starting for loop for dropdown")
$oButtons = _IETagNameGetCollection($oIE, "input")
Sleep(4000)

If IsObj($oButtons) Then
    For $oButton In $oButtons
        If $oButton.getAttribute("placeholder") = "Select a practice area" Then
            MsgBox(64, ' Button Found', 'Button found with value: ' & $oButton.getAttribute("value"), 2)
      _IEFormElementSetValue($oButton, "BAG - Co Comm Bristol" )
               Sleep(2000)
               $oButton.focus
               Send("{Enter}")
            ExitLoop
        EndIf
    Next
EndIf

;Get IDs of the boxes on this screen
$Client_WhoIntroducedUSID  = _IEGetObjByID($oIE, "Client_WhoIntroducedUS")
$Client_IndividualsWithSignificantHoldingsID = _IEGetObjByID($oIE,"Client_IndividualsWithSignificantHoldings")
$Client_ClientInstructionsID = _IEGetObjByID($oIE,"Client_ClientInstructions")
$Client_TransactionValuesID = _IEGetObjByID($oIE,"Client_TransactionValues")
$Client_WhyConfidentClientCanPayID = _IEGetObjByID($oIE,"Client_WhyConfidentClientCanPay")
If @error then
      ConsoleWrite(@CRLF & "Error trying to _IEGetObjByID on  following web ID: Client_WhyConfidentClientCanPay")

      EndIf
$Client_WhyNotHadFaceToFaceID = _IEGetObjByID($oIE, "Client_WhyNotHadFaceToFace")
$Client_SourceOfFundsID = _IEGetObjByID($oIE,"Client_SourceOfFunds")
If @error then
      ConsoleWrite(@CRLF & "Error trying to _IEGetObjByID on  following web ID: $Client_SourceOfFundsID")

      EndIf


;Input data of the boxes
_IEFormElementSetValue($Client_WhoIntroducedUSID, "Testing field ID Client_WhoIntroducedUS. Random no: " & Random(1,10000, 1))
_IEFormElementSetValue($Client_IndividualsWithSignificantHoldingsID, "Testing field ID Client_IndividualsWithSignificantHoldings Random no: " & Random(1,10000, 1))
 If @error then
      ConsoleWrite(@CRLF & "Error trying to _IEFormElementSetValue on  following web ID: Client_IndividualsWithSignificantHoldings")

      EndIf
_IEFormElementSetValue($Client_ClientInstructionsID, "Testing field ID Client_ClientInstructions Random no: " & Random(1,10000, 1))
_IEFormElementSetValue($Client_TransactionValuesID, "Testing field ID Client_TransactionValues Random no: " & Random(1,10000, 1))
_IEFormElementSetValue($Client_SourceOfFundsID, "Testing field ID Client_SourceOfFunds Random no: " & Random(1,10000, 1))
_IEFormElementSetValue($Client_WhyConfidentClientCanPayID, "Testing field ID Client_WhyConfidentClientCanPay Random no: " & Random(1,10000, 1))

;Test that data has been input
Sleep(3000)
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_WhoIntroducedUSID, "Ensure $Client_WhoIntroducedUSID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_IndividualsWithSignificantHoldingsID, "Ensure $Client_IndividualsWithSignificantHoldingsID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_ClientInstructionsID, "Ensure $Client_ClientInstructionsID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_TransactionValuesID, "Ensure $Client_TransactionValuesID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_SourceOfFundsID, "Ensure $Client_SourceOfFundsID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_WhyConfidentClientCanPayID, "Ensure $Client_WhyConfidentClientCanPayID is correctly input into field ")
;  Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_WhoIntroducedUSID, "Ensure $Client_WhoIntroducedUSID is correctly input into field ")

$WhyNotHadFaceToFaceDropdown = "No"

If $WhyNotHadFaceToFaceDropdown == "No" Then
   $Client_WhyNotHadFaceToFaceID = _IEGetObjByID($oIE, "Client_WhyNotHadFaceToFace")
   _IEFormElementSetValue($Client_WhyNotHadFaceToFaceID, "Testing field ID Client_WhyNotHadFaceToFace Random no: " & Random(1,10000, 1))
   Check_A_Field_Contains_In_InternetExplorer($ClientReferringPartnerID, $Client_WhyNotHadFaceToFaceID, "Ensure $Client_WhyNotHadFaceToFaceID is correctly input into field ")

   Endif



;To Do - Change drop downs

; Click Next

Sleep(4000)
;below function in Generic Fucntions
ConsoleWrite("Starting for loop for 2nd next button on Due Digilgence Assesement Screen" & @CRLF)
$oButtons = _IETagNameGetCollection($oIE, "input")
Sleep(4000)
If IsObj($oButtons) Then
    For $oButton In $oButtons
        If $oButton.getAttribute("value") = "Next" Then
            MsgBox(64, ' Button Found', 'Button found with value: ' & $oButton.getAttribute("value"), 2)
            _IEAction($oButton, 'click')

            ExitLoop
        EndIf
    Next
EndIf

 

What is weird is that after the error line it seems to execute that code as it enters all the data on the IEFormsetvalue bits  

Any idea how to troubleshoot this>?

Edited by CaptainBeardsEyesBeard

Share this post


Link to post
Share on other sites

in fact I realised it's in my generic functions file which is here

1.thumb.png.e807771cbbe60ceb81563f75519d386c.png

 

and code for this function for checking a field in IE is here

Func Check_A_Field_Contains_In_InternetExplorer($ObjID, $ObjExpected, $FieldBeingTested)
    ConsoleWrite(@CRLF & $ObjExpected &  "$ObjID equals the following: " & $ObjID)
   FileWrite($TestLog, @CRLF & $ObjExpected & "$ObjID equals the following: " & $ObjID)
if IsObj($ObjID) Then
   if @error Then
               Console(@CRLF & "Error on IsObj($ObjID)  function")
         Endif
   if StringInStr($ObjID.Value,$ObjExpected) then
      if @error Then
               Console(@CRLF & "Error on stringinstring function")
         Endif
      MsgBox($MB_SYSTEMMODAL, "Test Result for field    " & $FieldBeingTested, "Test Passed:" & $ObjExpected & " " & $FieldBeingTested & "  matches the following value received "& $ObjID.value, 4)
         ConsoleWrite(@CRLF & @CRLF & "Test" & $TestCount & " Test Passed: " & $ObjExpected & " " &  $FieldBeingTested & "   matches the value expected " & $ObjID.value)

      FileWrite($TestLog, @CRLF & "Test" & $TestCount & " Test Passed: " & $ObjExpected & " " &  $FieldBeingTested & "   matches the value expected " & $ObjID.value)
      FileWrite($TestResults, @CRLF & "Test" & $TestCount & " Test Passed: " & $ObjExpected & " " &  $FieldBeingTested & "   matches the value expected ")

   Else
      MsgBox($MB_SYSTEMMODAL, "Test Result  ", "Test Failed:" & $ObjExpected & " " &  $FieldBeingTested & " doesn't match following value received "& $ObjID.value & "", 4)
      ConsoleWrite(@CRLF & "Test " & $TestCount & " Test Failed:"& $ObjExpected & " " & $FieldBeingTested & "    doesn't match the following value retrieved " & $ObjID.value)
      FileWrite($TestLog, @CRLF & "Test " & $TestCount & " Test Failed:"& $ObjExpected & " " & $FieldBeingTested & "     doesn't match the following value retrieved " & $ObjID.value)
      FileWrite($TestResults, @CRLF & "Test " & $TestCount & " Test Failed:"& $ObjExpected & " " & $FieldBeingTested & "     doesn't match the following value retrieved ")

       Sleep(4000)
    EndIf

 Else
    If @error Then
         ConsoleWrite(@CRLF & "Error on Check_A_Field_Contains_In_InternetExplorer function on ObjID")

       EndIf
  ConsoleWrite(@CRLF & $ObjID & $ObjID.Value &"Isn't an object")
  FileWrite($TestLog,@CRLF & $ObjID & $ObjID.Value &"Isn't an object" )
  FileWrite($TestLog, @CRLF & $ObjID & $ObjID.Value &"Test " & $TestCount & " Test Failed:"& $ObjExpected & " " & $FieldBeingTested & "      doesn't match the following value retrieved " & $ObjID.value)
  FileWrite($TestResults, @CRLF & $ObjID & $ObjID.Value & "Test failed: Not an object  ")

   EndIf
   $TestCount + 1

    EndFunc

 

Share this post


Link to post
Share on other sites

So after doing a bit of googling I came across this code to intercept Comm errors


 
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    ; Initialize a COM error handler
; This is my custom defined error handler
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
Endfunc

After then running my scripts I get this 



Any idea?

 

1.png

Edited by CaptainBeardsEyesBeard

Share this post


Link to post
Share on other sites

The document is in frame ?

Is this frame on different server than the main frame/document ?

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) *

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2020-11-20

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...