Forum Discussion

motorola's avatar
motorola
Contributor
13 years ago

Sys.process("firefox").Exists

in my script unit, I want to check whether firefox is initiated or not by using Sys.process("firefox").Exists. basically the if..else logic is to tell testcomplete to launch firefox if exists=false and if not, then check whether there's a window pointing to a certain url.

  if(Sys.Process("firefox").Exists == false)

  {

    //Runs the "firefox" tested application.

    TestedApps.firefox.Run();

  }

  else

    if(Sys.Process("firefox").Page("http://www.global-erp-solution.com*").Exists == false)

    {

      //Opens the specified page in a browser. The URL can hold either an absolute or a relative path to the page. The "Make Page object a child of the browser process" option should be turned on.

      Sys.Process("firefox").ToUrl("www.global-erp-solution.com");

    }



the test fails at the very first line. I don;t get it. shouldn't the execution resume to running firefox in the event firefox is not yet opened? but why do I get failed test instead?
  • Hi,



    To check whether Firefox is launched, obtain it with the WaitProcess method which allows you to handle non-existent processes safely.
  • I deliberately closed firefox, expecting the .exists to return false, so testcomplete will launch firefox (as shown in the snippet). Is this not the right way to do?
  • Hi,



    As I've already mentioned, use WaitProcess instead of Process.