It sounds like the user in this post experienced a similar issue and resolved the issue by using idx=‘1’ and idx=‘2’ to select the correct browser instance:
Hey @ppr
I am sorry if I confused you, every time I wrote tab I meant two browsers I am sorry and I really do know the difference as well on the same !!!
And yeah, the bot is getting confused on which window it must go leading to error eventually
@chenderson@chenderson
Yes is this a first option. However in my first RnD round for Shubham I found a scenario to get i failed. But never forget this as a working tool
May I ask you after looking on html id trick to check if the keep tracking of browser variables is working. If its failing could you please name the replicable fail scenario for further RnD - Thanks
@Shubham_Varshney
I guess you will get it work with the sandbox/Browser Variable approach and it will be fine.
For another isse at my end I was forced to have a closer look on some UiPath mechanism. I would like to share some Findings with you, as it gives some insights for maybe getting understood your issue (is always taking the first google browser)
It seems to me that an Attach Browser is doing a marriage between Browser and the Webpage:
Attach Browser Selector statement is using the first found result.
This could be reason as we cannot be more specific why we dont have control and Attach it to second Google Page
In my RnD I attached the CollectorBrowser with simplest Selector: <html /> and explored the content of CollectorBrowser.Element (A read Only Property), with the find method
It allowed me to retrieve all HTML uiElements representing each opened Page. With the help from a unique sepearating info retrieved from a particular HTML uiElement (I used url) it was possible to attach to a particular opened Webpage.
A side finding was that we can use uiElement for attaching to a window, so played with minimize window.
I do feel that the approach is helpfully to get more information on inactive tabs and its content. But that is another story
Feel free to play with the xaml Check3.xaml (15.7 KB)
@Shubham_Varshney
I explored this in my RnD and got a failiure. I tried this with an idx information within my loop when I was attaching with <html idx='"+(loopindex+1).toString+"'/> . However feel free to replicate it.
As by me exploration there is something like a take first html mechanism (refer to screenshot top one next to red URL). It didnt allowed to grap a particular HTMLelement from Browser.Element (this property on which I used the find method)
Sure for understanding it is helpfully to know some internal details. But I do feel, that we can gain more of this by looking into the topic browser tab change. BTW how are you implementing a tab change?
Naah I was looking into multiple browsers, reason I am getting a url from email and I am opening it and making a few updates and moving on to next. Let’s see how this works
For time being, I made the following update.
Closed the un-required browser and then re-opened it later.