Forum Discussion

loricotton's avatar
3 years ago

close browser

I am doing the script  if SYS.browser("chrome").Exist and it will return on a positive result but give a hard red error on non existant.  I am trying to close all open chrome windows and always get an error when chrome is not open and I check for its existance.  This started when I could not find out how many chrome windows I have open.

7 Replies

    • loricotton's avatar
      There is a deeper problem. I am trying to find out if chrome is active or not.
      When I try if browser.Browserwindow is visible, enabled, Disable, Exists, not exist I get the same results wether chrome is up or not.

      I have a simple if statment with a log then an else
      The same log message is issued with chrome up or down.
      • mattb's avatar

        Can you post your code in here. I can write a statement in python if that would help 

  • Hi loricotton 


    Can you try adding an Else statement to control what happens if Chrome is not open?

  • Mr_Bro's avatar
    Champion Level 0

    loricotton ,


    can you give a try the below approach and let me know it it works.

    function CloseBrowser()
      while (Sys.WaitBrowser().Exists)
    • loricotton's avatar
      I had the additional issue of a leave button with an unexpected popup.
      I used the code
      function closeallwindow()
      while (Sys.WaitBrowser().Exist)
      { Sys.WaitBrowser().Close()
      If (Aliases.browser.pageGdssGlobalDecisionSupportsys.Confirm.Exist)
      This does work for windows open and browser closed.
      This does give a warning message that chrome is working in the background. I turned off the warning box but the pie chart indicates a yellow. Is there a way I can get the project to not flag the warning?

      This work around was needed when I upgraded to the latest version of chrome. The close button no longer closed all the windows that were open and each window had to be closed. Will the browser Exist be available in a later version. Also I tried to create a loop for the number of windows open but could not get that number. FindALL, Findchild would not work, index would not work. The dropdown would list all the windows but I could not get the count. It seems that all the window or browser methods were not working.