Forum Discussion

nastester's avatar
nastester
Regular Contributor
3 years ago
Solved

Batch file closing before completing all steps

I have a batch file in TestedApps which I am executing via a script.  It is running/opening but seemingly only running the first command I have and then closing and the test is marked as successful....
  • nastester's avatar
    3 years ago

    I was able to solve this issue with this script: 

     

    function Setup() {
      
    //Run bat file from TestedApps
      var app = TestedApps.Items(0);
      app.Run();
      
      Delay(5000);
      Sys.Refresh();
      //Map console object
      var p = NameMapping.Sys.cmd.wndConsoleWindowClass;
      
      while (p.Exists) {
    //while bat is open, keep test running. Looks for text within the console window
        var IsOpen = p.WaitProperty("wText", "*Deleting dashboard records*", 1000);
        if (IsOpen == false)
        break;
        Aliases.cmd.RefreshMappingInfo();
      }
    }