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:

Firefox: 

Firefox safe mode

Firefox was accidentally switched off at boot time. This could be due to additional components or other reasons.

You can try troubleshooting in safe mode to solve this problem.You can also skip troubleshooting and try to refurbish Firefox.

Chrome:

Restore pages?

Chrome didn't shut down correctly.

----------------------------------------------

The problem does not happen with IE/Edge.

Please check the attachment(file b) in detail.


Looking forward for your reply.
Thank you.
---Steven Wang
 

 

 

  • 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();
      }

     

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    My guess is that you are opening and closuing the browsers too fast.  It would probably not be a bad idea for us to see the actual code you are attempting to use to do this so we can make some suggestions.   What I would suggest is that, after calling the browser.Close() method, add some code to wait for the process to be completely shut down before kicking off the next browser instance.  

     

    Also... interesting item.... the date and time of your test log is August, 2017...  Why wait 3 months to post the question?

    • ApplePen's avatar
      ApplePen
      Community Leader

      tristaanogreBefore I still collect the problems about our test by TestComplete.

      Recently submit them. So the date is Augest.

      Like the below ?:

      [ TestApps.Chrome.Close();

      if(!TestApps.Chrome.Close()){

        TestApps.Chorme.Terminal();

      } ]

       

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        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();
          }