Forum Discussion
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.
- xyin9 years agoOccasional Contributor
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:
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:
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:
It just looks odd that Chrome is treated differently when there are multiple instances.
I will look up the network suite option.
Thanks.
- AlexKaras9 years ago
Champion Level 2
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).
- xyin9 years agoOccasional Contributor
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.