Forum Discussion

BBMI's avatar
BBMI
Occasional Contributor
8 years ago
Solved

Cannot read property of undefined.

Hi,

for the simple script: function tttt(){ Log.Message("uuuu")}

i receive the message : "Cannot read property of undefined."

can anyone help me why TestComlpete lost the pedals

thanks in advance

  • BBMI's avatar
    BBMI
    8 years ago

    Thank you very much for your help.
    in fact the problem comes from the fact that the Excel file is used in "Data-Driven Loop" as a variable, then, used in the "Script" as an external file.
    cordially

10 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Works fine for me... Tells me that there's something else going on.

     

    Do you have an event handler for "OnLogMessage" in your project?

    • BBMI's avatar
      BBMI
      Occasional Contributor

      I do not understand, everything worked and suddenly TestComplete starts messing around: TypeError Can not read property of undefined.

      function Test1 ()
      {
         // Executes the specified code snippet.
         BuiltIn.ShowMessage ("yyy");
         // Executes the specified code snippet.
         Log.error ("uuuu");
      }

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        I'm assuming you've exited out of TestComplete, restarted the application, and tried again with the same results?

  • BBMI's avatar
    BBMI
    Occasional Contributor

    Yes that's right, even restarting the PC and TestComlpete, the problem reappears, and this is the first time I've had it for 3 years, I use version 12.20.

    • cunderw's avatar
      cunderw
      Community Hero

      Where does your log say the exception is occurring? Does it point to that function or somewhere else in the code? Can you post a screenshot of the log call stack for the undefined error?

  • BBMI's avatar
    BBMI
    Occasional Contributor

    By the way, the error "Can not read property of undefined." after the appearance of the error "MS Office Access Data Engine" that I can not solve.
    thank you for your help

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      The problem is with your excel driver... everything else comes from that.  Check out the following post and see if this relates.

      https://community.smartbear.com/t5/TestComplete-General-Discussions/Warning-Windows-updates-break-interaction-with-xls-files-from/m-p/152267#M28117

       

      My guess is that there was an updated done to your machine recently that alters the Excel drivers.  Solve the excel problem, and the "cannot read property of undefined" will go away.

      • BBMI's avatar
        BBMI
        Occasional Contributor

        Thank you very much for your help.
        in fact the problem comes from the fact that the Excel file is used in "Data-Driven Loop" as a variable, then, used in the "Script" as an external file.
        cordially

    • cunderw's avatar
      cunderw
      Community Hero

      Can you provide a screen shot of the last error in your PDF, but on the "Call Stack" Tab as opposed to the "Additional Info" you currently have selected?

  • BBMI's avatar
    BBMI
    Occasional Contributor

    That is to say: The error appears:
    1- when a variable (Excel file) is used in the same script (function), we can not update the same file through:
    var conn = Sys.OleObject ("ADODB.Connection");
    conn.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12 ......
    var Request = "UPDATE [Tab1 $ A" ....... "] SET F1 = .....
    conn.Execute (Application);
    conn.Close ();
    2- Or, when using Data-Driven Loop to browse a variable (Excel file) and we use a script (function) to update this same file through
    var conn = Sys.OleObject ("ADODB.Connection");
    conn.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12 ......
    var Request = "UPDATE [Tab1 $ A" ....... "] SET F1 = .....
    conn.Execute (Application);
    conn.Close ();
    3- Bypass Solutuion:
    go through a temporary variable (Excel file)

    My Excel File -> Temporary Excel File
    Temporary Excel file -> My Excel file