Question
Tech Mahindra Ltd
IN
Last activity: 2 Mar 2022 8:03 EST
Open same URL in 2 different chrome browser and login with 2 different users in separate session each
I have to open two chrome browser window(not incognito) for the same URL through two Universal adapters and login with two different users with separate sessions for each. Screens remain same for first 2 pages for both browser windows(Login Screen and Home Screen)
But problem here is, I login with first user on first chrome browser window then when second chrome window opens it opens directly the home screen which first chrome browser is at, second chrome browser window not taking me to login screen, hence ending with same user on both the browsers. Please can someone assist here to resolve this. @ThomasSasnett Please help here. One more thing second adapter performs actions on the first browser window instead of second, as both screens are same here , how to overcome this.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
@usantoshThere really is no way to do this with two adapters using the same browser. You could do this easily by using Chrome for one and Edge for another. A slightly more complex way would be to enable UseKeys for each page and associate each instance with the BrowserForm.WindowHandle (which you can acquire from each page). If using Edge and Chrome at the same time is not possible, then let me know if you'd like an example of using the BrowserForm.WindowHandle to allow you to know which page belongs to which instance of the application.
Tech Mahindra Ltd
IN
@ThomasSasnett Thank you for the prompt response, really appreciate for you help. I would like to have an example of using the BrowserForm.WindowHandle to allow you to know which page belongs to which instance of the application. Just want to confirm that this BrowserForm.WindowHandle way is for two chrome browsers scenario right? and also please let me know if we can do this with one normal chrome browser and other with incognito mode chrome browser.
Pegasystems Inc.
US
@usantosh I don't believe you can use Incognito mode. I added the -incognito switch to start Chrome to test and it did not match either window. I also tested one on one off, but neither worked. I have not known any customers automating incognito.
As for the window handle. This is a property of a given page. It returns the window handle of the UI that is hosting a given page. Since this value is unique, you could record it and use it to determine which instance of the browser a given page belongs to. Since you would need to enable UseKeys on every page, whenever you navigated through your application, each instance of each page will generate its own unique key. This isn't really trackable as it has no specific relation back to the page before it. Using the window handle though would given you a data point that you can refer to and associate a given page with a given window. This only works though if the pages are launched in separate windows. If a user decided to combine the pages into tabs on a single window, they'd have the same handle and would therefore be indistinguishable. That would be one of the things you'd want to advise users against doing.
@usantosh I don't believe you can use Incognito mode. I added the -incognito switch to start Chrome to test and it did not match either window. I also tested one on one off, but neither worked. I have not known any customers automating incognito.
As for the window handle. This is a property of a given page. It returns the window handle of the UI that is hosting a given page. Since this value is unique, you could record it and use it to determine which instance of the browser a given page belongs to. Since you would need to enable UseKeys on every page, whenever you navigated through your application, each instance of each page will generate its own unique key. This isn't really trackable as it has no specific relation back to the page before it. Using the window handle though would given you a data point that you can refer to and associate a given page with a given window. This only works though if the pages are launched in separate windows. If a user decided to combine the pages into tabs on a single window, they'd have the same handle and would therefore be indistinguishable. That would be one of the things you'd want to advise users against doing.
For the sample solution, click the Start button first and it should launch two new Chrome windows. I am automating Wikipedia, so it is rather simplistic. I would position them apart from or next to each other so you can watch the search perform on the correct window. In a nutshell, the first window started will have us record the window handle into a global variable for Window 1. The second will record into Window 2. I can then iterate through all matching pages to check which one exists and matches that handle. Let me know if you have any questions.
Tech Mahindra Ltd
IN
@ThomasSasnett Thank you so much for the clarification and the solution provided. I have to check with my client if they accept this solution. Will check and get back to you .Anyways thank you so much.
-
Marissa Rogers
Tech Mahindra Ltd
IN
@ThomasSasnett I have to open one session in Chrome Incognito mode and second session in Normal Chrome mode for the same URL and see if it works. I have enabled the Incognito mode in chrome for Pega Robotics extension, but no idea on how to open/launch page in Incognito mode, it always opens in normal mode. Can you please provide the steps on how to open the url in incognito mode.
Tech Mahindra Ltd
IN
@ThomasSasnett I'm unable to open the project MultipleUWAAppInstances shared by you, I'm trying open in Studio Ver Proprietary information hidden, PFA screenshot, just says loading the solution projects.