Forum Discussion

Lagencie's avatar
Lagencie
Frequent Contributor
7 years ago

Browser Loop Close and Reopen Browser

Hello,

 

is it possible to close and reopen the browser during a Browser Loop Teststep?

 

I know that I can close the browser with browser - close Operation ... but I can't figure out how to reopen the same browser, that is used in the running browser loop operation.

 

As I need a new session, ctrl F5 doesn't work in this case.

 

Would be thankful for any help

4 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    You can use another loop (FOR, WHILE) instead of Browser Loop:

     

    WHILE something
        open browser
        do something
        close browser
        open browser
        do something
        ...
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I think that you will need a piece of coding here.

    Browser Loop gets a list of installed browsers, iterates through it then and launches the next browser from the list. The launched browser is identified by its name and bitness (and also version, but this is irrelevant because it is not too common to have, say, two different versions of Chrome an the same box at the same time).

    So, when you need to restart the browser, you need to get its name and bitness using properties of the CurrentBrowser object (this is where the coding will be needed), close the browser, wait until its process gone, start new instance of the browser using name and bitness obtained previously and continue.

    • jamiemorrow's avatar
      jamiemorrow
      New Contributor

      Do you have an example of how to get the name and bitness from a script?

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > how to get the name and bitness

        The name and bitness of what?

        Have you examined properties of the process/object of interest in the Object Browser?

        Have you read the documentation for Process, Browser, BrowserInfo or other object that you are interested in?