Forum Discussion

fayizkc's avatar
fayizkc
Occasional Contributor
6 years ago

How can I open new browser session by test complete

I need to work on multiple urls in my project with different browser instances. When I use Browsers.Item(btIExplorer).Run(url1)It is entering url with existing browser.

When I try WshShell.Run("iexplore.exe " +url2), IE is getting hang every now and then. It is not working always

When I try  Sys.Browser('iexplore').BrowserWindow(0).Keys("^t"), it is opening new tab, but still url is entering in the previous tab. 

Question 1: Is there any direct method in Testcomplete to launch new browser instance (in IE & Chrome)

Question 2: If no, how can I identify the last opened browser and enter my application URL to that browser.

5 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    fayizkc wrote:

    Question 1: Is there any direct method in Testcomplete to launch new browser instance (in IE & Chrome)

    AFAIK, There is no direct way to ignore the current instance of chrome/ie and open a new browser instance. 

     


    fayizkc wrote:

    Question 2: If no, how can I identify the last opened browser and enter my application URL to that browser.


    Check using Sys.Process("browser").Exists. If exists then use that browser instance to do so.

     

     

    • fayizkc's avatar
      fayizkc
      Occasional Contributor

      Shankar,

      As I want to work with multiple URLs at same time, Sys.Process("browser").Exists will be true if I need to open new browser instance. My requirement is, need to open a new url as a separate instance to validate something in between the execution of my primary url without closing it. What solution we have in Test complete

      • shankar_r's avatar
        shankar_r
        Community Hero

        If you want to launch a new browser instance then you can use WshShell like below

        WshShell.Run("powershell -command start chrome ");

        to activate the chrome, loop thru the browser instances.

  • MK298's avatar
    MK298
    Occasional Contributor

    As you mentioned  - When I try  Sys.Browser('iexplore').BrowserWindow(0).Keys("^t"), it is opening new tab, but still url is entering in the previous tab. - Focus will be on to the previous tab. When a new tab is created using Keys Method, You have to click on the Edit Bar of the browser for the new tab and then enter the URL.

     

    Later you can use Keys method to navigate between tabs.