Forum Discussion

techgirlbb's avatar
techgirlbb
Contributor
6 years ago

opening url in new browser window

Hi one of my team requirement is open an application in new browser window. if have the below Javascript code

Browsers.Item(btChrome).Run("https://google.com");

 which is replacing the existing active  browser window url and lauching the application if any of browser currently open.

Else lauching the application in new browser window.

but  the requirement is :

Open an application in an new browser(Chrome) window  even if  the browser window opens.

Do we have an y TC operation for it?

 I looked at the exisitng forum posts and tried didnot help. 

 

https://community.smartbear.com/t5/TestComplete-Functional-Web/Open-a-new-browser-window-function/m-p/86097?collapse_discussion=true&q=second%20browser%20window&search_type=thread

https://community.smartbear.com/t5/TestComplete-Functional-Web/Opening-second-browser-window/m-p/122851?collapse_discussion=true&q=second%20browser%20window&search_type=threa

 

 

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Question:  Is this a requirement of the application, that you need to be able to open a second browser window and perform some actions against it?  Or is this a requirement of the written manual test that you're converting to automation? 

     

    While technically speaking, automated tests should be able to do everything a manual test does, one of the bonuses of having a well written, coded, robust automated test is that you don't HAVE to do what is manually written.  The question I would have of the manual test is "Why do we need a second browser window?  What is the functionality that we're trying to test?"  The answers to that may dictate that, while manually this seems to make sense, for an automated test, it might be sufficient to simply close the browser and reopen it to a new URL.  

    So... what's the purpose of the second browser window?  What are you trying to achieve?  Perhaps there's another way of doing which, in the meantime, may work better than other suggestions.

  • MK298's avatar
    MK298
    Occasional Contributor

    Hi,

     

    I tried this piece of code in python, Where i am able to open a new browser window, when one instance of the browser is already present.

     

    You can convert this piece of code to your desired language and try it out.

     

    import os

    os.system("start chrome https://www.google.com/ --new-window")