Forum Discussion

dmacknight's avatar
dmacknight
Occasional Contributor
9 years ago

Differences in recording JScripts

Hello,

 

When I record a script, it gives me variables for new dialogs and other objects. When a coworker records the same script, he is getting explict references to the same objects.

 

Is there a configuration setting that we have missed?

 

Thanks,

Dave

 

My script looks like this:

function Test1()

{

var sensorWorks;

var dlgNew;

var manageJob;

sensorWorks = Aliases["SensorWorks"];

sensorWorks["SensorWorksMain"]["MainMenu"]["Click"]("Project|New");

dlgNew = sensorWorks["dlgNew"];

dlgNew["ComboBoxEx32"]["SetText"]("test2");

dlgNew["btnOpen"]["ClickButton"]();

manageJob = sensorWorks["ManageJob"];

manageJob["textBoxJobNumber"]["SetText"]("123456");

manageJob["buttonOk"]["ClickButton"]();

}

 

 

His script looks like this:

function Test1()

{

var sensorWorks;

sensorWorks = Aliases.SensorWorks;

sensorWorks.SensorWorksMain.MainMenu.Click("Project|Open");

sensorWorks.dlgOpen.OpenFile("\\\\fs1\\Engineering\\MikeRakhunov\\200123_add_file_040716.proj");

sensorWorks.ManageJob.buttonOk.ClickButton();

}

 

 

  • Hi Helen,

     

    Thanks for the reply but I'm still having problems. I tried changing the script engine on both systems and it does not seem to make any difference. I have installed another license on my primary laptop running Win8 and I'm getting the same results as my co-worker running Win10: the dot notation.

     

    Dave

  • EVarnavsky's avatar
    EVarnavsky
    SmartBear Alumni (Retired)

    In both cases all settings are configured properly. But you should know that TestComplete creates variables only for objects used more then once.

    • dmacknight's avatar
      dmacknight
      Occasional Contributor

      Hello and thank you for your responses. I found the setting in Tool->Options but it is not what is causing the problem. It was un checked. Checking gives everything an Alias. I also still don't know why, when I record a test it looks like this:

       

      sensorWorks["SensorWorksMain"]["MainMenu"]["Click"]("Project|New");

       

      And when my co-worked records a test it looks like this:

       

      sensorWorks.SensorWorksMain.MainMenu.Click("Project|Open");

       

      Thanks,

      Dave

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        dmacknight wrote:

        I also still don't know why, when I record a test it looks like this:

        sensorWorks["SensorWorksMain"]["MainMenu"]["Click"]("Project|New");

         

        And when my co-worked records a test it looks like this:

        sensorWorks.SensorWorksMain.MainMenu.Click("Project|Open");

         

         


        If you mean different syntax (["SensorWorksMain"] vs SensorWorksMain), this is because your project uses C#Script or C++Script as a scripting language, and your co-worker's project language is JScript. C#Script/C++Script use the bracket notation object["Property"] rather than dot notation object.Property.

  • cunderw's avatar
    cunderw
    Community Hero

    Tools > Options > Engines > Recording

    Check box for Do not generate variables under script recording.