Forum Discussion

rzirpolo's avatar
rzirpolo
Occasional Contributor
6 years ago

Utilising If.. Then to check if browser running

Version: 12.50.4142.7 x64

 

I am noticing very intermittent behaviour for tests in my Project Suite which utilise running a browser (Internet Explorer).

 

I have common failures that the "Run Browser" command simply doesn't work so this then breaks the test. I have previously tried to do this alternatvley utilising Start > Run option and I have seen references to code but I just want to use the available option to run a browser and for it to be consistent.

 

I did think I can use an If ... Then condition using Sys.WaitBrowser().Exists Equals False that if the Run Browser doesn't work this is can be triggered but this doesn't seem to work.

 

Any advice would be appreciated.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    In general your approach is correct. You are correctly using .WaitBrowser() to check if the given browser process is running.

    The case is that quite often I've seen that IE does not always closes its process and this causes TestComplete to stuck until IE process is closed. So in case of IE you may choose not to check whether IE is running or not, but terminate all running instances of IE and start it anew.

    Relevant discussion along with the code can be found here: https://community.smartbear.com/t5/TestComplete-Functional-Web/Leave-site-pop-up-is-getting-displayed-if-I-use-stop-test-item/m-p/184687/highlight/true#M34437

     

    • rzirpolo's avatar
      rzirpolo
      Occasional Contributor

      So instead of using the GUI it's best to write underlying code to achieve proper closure of browser instances? The behaviour is very intermittent when using the GUI functions. Sometimes it will open a browser window, sometimes it won't.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > So instead of using the GUI it's best to write underlying code to achieve proper closure of browser instances?

        You may try to close browser using GUI, wait for some time (depending on your tested application) for the browser process to not exists and terminate the process if it did not end within the timeout (with or without warning posted to test log, which is up to you).

        It is my understanding that the behaviour depends on the tested application, as I had a web application that quite often caused IE process to stay in memory while everything was fine with other browsers (FF, Chrome, Edge).

         

        P.S. And check that you have set up IE according to the recommendations from TC help (especially - to disable it running in the background).