cancel
Showing results for 
Search instead for 
Did you mean: 

How to identify multiple Chrome browser instances

Occasional Contributor

How to identify multiple Chrome browser instances

Hi,

 

I need to automate/simulate multiple users (3 and more) logging in to their accounts of an instant messaging website and communicate with one another. We have to use Chrome browser for all users.

Here's a sample site: iceim.theice.com

 

I realized that, for example, if userA logs into his account using a default Chrome browser, any subsequently opened browser, when navigated to the above site, will automatically load userA's session.


I could open an incognito Chrome window, which will let userB login. But this only allows 2 user sessions, I can not use another incognito window to let userC login.

 

I have found a way by using a Chrome option to make multiple (3+) user login sessions available:
chrome.exe --user-data-dir="C:\temp\user1"
chrome.exe --user-data-dir="C:\temp\user2"
chrome.exe --user-data-dir="C:\temp\user3"
...

 

My question is: How to identify different Chrome browser instances?

 

Again, only Chrome can be used, and all users login to the same web site.

 

I would appreciate if someone could provide some VBScript sample.
I searched the community forums but couldn't find any useful information.

 

Thanks a lot.

12 REPLIES 12
Community Hero

Re: How to identify multiple Chrome browser instances

I think you would run into instances of Ambiguous Recognition with multiple browsers open on one machine.  

 

Would it be a more realistic test if you ran the test on each of three machines?  I can see it being something like

 

Parameters = User, Chat1, Chat2

 

Login with User

Send message to Chat1

Send message to Chat2

Verify message from Chat1

Verify message from Chat2

 

Run that same test on three machines with different combinations in the parameters

Community Hero

Re: How to identify multiple Chrome browser instances

Hi,

 

The most reliable way is to be able to identify separate chrome windows/pages from the very start of the test. For example, it might be possible to perform an automated login into your tested application when starting browser (e.g. something like navigating to http://iceim.theice.com@user1:pwd1/) and then identify the new web page by looking for the provided user name (user1 in the above example).

If nothing like the above is possible, you may consider a kind of workaround that should work. The idea is that every new instance of Chrome will have incremented value of the window index property (in TestComplete's Object Browser). So the workflow is like that:

1. Close all Chrome instances (Chrome must be configured to not run in the background);

2. Set initial expected value of window index to '-1' (because the first window will have index of zero);

3. Start new instance of Chrome, increment the value of expected window index and search for the Chrome window with this index. Navigate to the required address and store the reference to the page to be used later in tests;

4. Repeat step 3 required number of times.

 

However, I would also recommend you to consider the option of the Network Suite in TestComplete (https://support.smartbear.com/viewarticle/81321/). This will leave you with only one Chrome instance on every test machine and you should be able to synchronize test actions (e.g. check for some message on machine B only after the message was posted on machine A) with the help of Synchronization Points provided by the Network Suite.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Occasional Contributor

Re: How to identify multiple Chrome browser instances

Marsha_R,

 

Thanks for the reply.

 

However I'd prefer using one machine to automate the testing since I'm not sure how hard it is to run a test to control AUTs on different machines.

Occasional Contributor

Re: How to identify multiple Chrome browser instances

AlexKaras,

 

Thanks for the reply.

 

Can you give some example scripts on your step 2 and 3? Thanks.

 

I did some tests and here is what I found:

 

After I opened multiple Chrome browsers with the "--user-data-dir=C:\temp\userxxx" option, in TestComplete Object Browser, these Chrome browsers looked the same, all were shown as

             Sys.Browser("chrome")

 

So I had no way to differentiate them. See screen shot:

 

Case_00197898_Chrome-ObjBrowser_chrome.JPG

 

As comparison, I used multiple IE browsers with "-private" option, and they could be differentiated in the Object Browser like:

             Sys.Browser("iexplore"), Sys.Browser("iexplore", 2), Sys.Browser("iexplore", 3), etc.

So I could define them as different objects in my script and do tasks like loading login page, using different user ids and passwords to login, etc.

See screen shot:

 

TC_IE_3IEinObjBrowser.JPG

 

As a matter of fact, I opened multiple instances of some Windows applications such as Notepad, Command prompt, all were shown in the Object Browser as differentiable ones:

 

Case_00197898_NotepadCmdprompt_ObjBrowser.JPG

 

It just looks odd that Chrome is treated differently when there are multiple instances.

 

I will look up the network suite option.

 

Thanks.

Community Hero

Re: How to identify multiple Chrome browser instances

Hi,

 

> Sys.Browser("iexplore"), Sys.Browser("iexplore", 2), Sys.Browser("iexplore", 3), etc.

Actually, I expected to see the same for Chrome as well... I cannot say what Chrome browsers are displayed just like Browser("Chrome") on your screenshot, but considering that they have different indexes (again, as per your screenshot), I would try to reference Chrome processes the same way: Sys.Browser("Chrome"), Sys.Browser("Chrome", 2), etc. Have you tried this? Does it work? If it works, than I would consider it as an Object Browser display problem and report it to Support (https://support.smartbear.com/message/?prod=TestComplete).

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Occasional Contributor

Re: How to identify multiple Chrome browser instances

AlexKaras,

 

Yes I tried those and got "object does not exist" error for Sys.Browser("Chrome", 2).

I opened a ticket with SmartBear and they admitted this is an issue.

 

Thanks.

Contributor

Re: How to identify multiple Chrome browser instances

Just for your information, on W10 Pro or W7 Pro, with TC 12, the problem is resolved, we have the process index given in object spy.

 

 

 

Un sourire et ça repart
Occasional Contributor

Re: How to identify multiple Chrome browser instances

bbi,

 

I think the scenario you mentioned is for multiple browser windows under one user profile, while mine needs multiple user profiles (see my earlier posting).

 

I still have the support ticket open with SmartBear and just had an update today saying there is no solution yet.

 

Community Hero

Re: How to identify multiple Chrome browser instances

@xyin:

 

Interesting... Thank you for the update.

 

Have you considered the option of the Network Suite in TestComplete (https://support.smartbear.com/viewarticle/81321/) to sort this out?

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors