Forum Discussion

ApplePen's avatar
ApplePen
Community Leader
7 years ago
Solved

Playback the script (function: repeatedly open and close the browser) , unexpected dialog popup

Playback the script (function: repeatedly open and close the browser) , unexpected Message will be popup. ---------------------------------------------- The message of the unexpected dialog: Firef...
  • AlexKaras's avatar
    AlexKaras
    7 years ago

    Hi,

     

    I would recommend to consult documentation that contains a lot of useful information.

    .Close() method does not return anything, so it is useless to do a verification like if (.Close()).

    Also, attempting to close an application two times in a row can easily cause unpredictable behavior.

    And finally, it is better to copy/paste your real code than to type it as occasional typo(s) (like TestApps, Chorme, Terminal) can easily mislead others.

    The code from the sample provided in the help for the .Close() method adopted to your case may look like this:

     

      p = TestedApps.Chrome;
    
      // Closes the process
      p.Close(10000);
      // Checks whether the process is closed
      if (p.Exists)
      {
        Log.Warning(p.ProcessName + " seems to hang, terminating.");
        p.SaveDumpToLog();
        // Terminates the process
        p.Terminate();
      }