Forum Discussion

jonathan_ehman's avatar
jonathan_ehman
New Contributor
11 years ago

Troubles with Firefox reliability during TestComplete test

Our company runs a large number of tests on our email client using TestComplete.  This includes going to each page and making sure that it loads and certain information is displayed in multiple languages.



We found that of all the browsers, Firefox was the fastest and most reliable with TestComplete.  However, there are times that FF will simply stop loading a page with no warning.  Going to the page and testing in the same conditions reveals no issues with the page itself.  



The following are some of the things we did to increase reliability.

We currently completely shutdown (as in end the process of) Firefox after each test using the Sys.Process("firefox").Close().  When the Firefox process fails to close, then we call Terminate() on it.  We also make liberal use of Refresh() on the page.



Does anyone know of any other ways to increase the reliability of the fore mentioned tests?
  • You need to identify when the screen refreshes and then make a call to wait for the screen to redraw.



    Our web pages have tabs on them, so after running the click method on a tab, I then call WaitForPageToRedraw().  Other situations are when navigating to different pages, or when clicking on a button that changes the UI to display a grid.



    In one situation I have to put a delay in before calling WaitForPageToRedraw() due to a lag between clicking the Save and Close button and the screen beginning to redraw.
  • You need to identify when the screen refreshes and then make a call to wait for the screen to redraw.



    Our web pages have tabs on them, so after running the click method on a tab, I then call WaitForPageToRedraw().  Other situations are when navigating to different pages, or when clicking on a button that changes the UI to display a grid.



    In one situation I have to put a delay in before calling WaitForPageToRedraw() due to a lag between clicking the Save and Close button and the screen beginning to redraw.
  • Good luck!



    I also do something similar to what you do.

    If one of my tests fail, I terminate the browser and restart from the failed test.

    This is useful as sometimes I get unexpected windows.  These windows don't have frames, so TestComplete doesn't trigger the unexpected window event.  Running the test the 2nd time usually doesn't result in the unexpected window being displayed.
  • Hi Jonathan,

    I've had issues with pages stop loading in FF with no warning as well.

    I have found my following code to improve this issue signficantly for our tests:



    sub WaitForPageToRedraw()



        '--- Description ---

     

        ' Wait for the screen to redraw before continuing

     

        ' ---- Declaration ----

     

        dim page      ' Reference to the browser page  

        dim RedrawComplete

        

        '--- Code ---

     

        Set page = Sys.Browser(gBrowserToUse).Page("*")

        RedrawComplete = page.Wait(60000)

        if RedrawComplete = "" then

            ' The redraw failed - try Ctrl + F5

            sys.browser(gBrowserToUse).page("*").Keys("^[F5]")

        end if

        

        '---- Clean up ----

        

        set page = nothing

     

    end sub
  • Thanks Adrian.



    Our tests run using TestExecute between midnight and four in the morning.  Is there a way to use this function when I am not able to be at the machine running the tests while they are running?
  • Thanks Adrian!



    I'm going to try this when I'm back in the office tomorrow.  I appreciate your time :)  I'll let you know how it turns out :)
  • I know this is ... well, a long time coming, but here's what I ended up doing based primarily on your ideas:




    function CloseBrowser()


    {


      isFirefox = g_BrowsertoUse.ItemName == "FireFox";


      if (isFirefox) {


        var browserProcess = Sys.Process("firefox");    


      }


      


      g_BrowsertoUse.Close();


      


      if (isFirefox) {


        var ffClosed = browserProcess.WaitProperty("Exists", false);


        if (!ffClosed) {


          browserProcess.Terminate();


        }


      }


    }



    So far it has worked like a charm.  



    Thank you for your help :)