Forum Discussion

klabbe's avatar
klabbe
Occasional Contributor
3 years ago
Solved

TestcComplete does not find chrome browser with "Sys.WaitBrowser"

Hi,

I have a script that validate if the browser Exists and if true it calls the Navigate method and if not it call the Run method.

 

My problem is :

 

Even though the browser is already running, it always thinks that it's not. So the script calls the Run method. The funny thing is that afterward, the log has en entry saying "the browser is already running". I know !!!

 

I've put a delay of 10 seconds and it doesn't change anything.

 

This is the method :

 

def ClickBoutonOkFiltres():
    url = Project.Variables.navigate_url
     # Launch Chrome if it is not running
     if (Sys.WaitBrowser(btChrome, 10000).Exists):
          Browsers.Item[btChrome].Navigate(url)

     else:
          Browsers.Item[btChrome].Run(url)

 

This is the message in the log afterward :

 

 

Thanks !

2 Replies

  • Hello klabbe ,

    Sys.WaitBrowser Method requires only browser process name "chrome" not the browser constant btChrome. So, you can change the below code as,

    def ClickBoutonOkFiltres():
        url = Project.Variables.navigate_url
         # Launch Chrome if it is not running
         if (Sys.WaitBrowser("chrome", 10000).Exists):
              Browsers.Item[btChrome].Navigate(url)

         else:
              Browsers.Item[btChrome].Run(url)

     

    Refer, https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/waitbrowser-method-sys-object.html 

    • klabbe's avatar
      klabbe
      Occasional Contributor

      HI naveens33_ 

       

      So the browser constants do work for the "Navigate" and "Run" methods but not for the Sys.WaitBrowser !!!

       

      I should have think about that :-(. Because the other methods works with the constant I assumed it will work with the "WaitBrowser".

       

      Thanks for your reply !