Forum Discussion

danrald's avatar
danrald
Occasional Contributor
8 years ago

Sys.WaitBrowser does not work

I have code that randomly works.

 

browser = Sys.WaitBrowser("*",10000);

page = brower.FindChild("ObjectType", "Page", 1000);

 

 

sometimes the "FindChild" returns a null. I can never count on this, sometimes it works, sometimes it does not.

 

Thanks

4 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    You may want to specify a browser (in case you have different browsers running) but you should otherwise be able to use this instead.

     

    Example:

    var wshell = new ActiveXObject("WScript.Shell");
    var getpagetest = Sys.WaitBrowser("*",10000).WaitPage("*",10000);
    wshell.popup(getpagetest.Name);
    • danrald's avatar
      danrald
      Occasional Contributor

      I forgot to mention. This works fine in TestComplete, but does not work in Test Execute!

       

      thanks

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        When it comes to these sorts of things, especially the code you are using, there is very little different between TC and TE. So, what that says is that there is something that is configured by default in the TestComplete environment that is not configured likewise in the TestExecute environment.

        If they are running on different machines, project variables and project suite variables may get initialized with different values. Also, there are other features, etc., that might start up differently, like auto-running applications.  Your code assumes that the browser is started.  Now, you didn't show us any code that says that the browser will actually execute so I can't say for certain if the browser is actually started by TC or TE. So, it could entirely be that the TC environment somehow auto-launches the browser while the TE environment does not. I'm a little new to TC 12 and some of the new features but my guess is that some of the parameters on tests, etc., are location dependent.   Do some research into how you are configured to launch your browser and see if you can globalize some if it.