Wrong browser window selected

I thought I had understood window selection but apparently not. If I have a browser window open and my automation is to access the same site using it’s own window, it always fail to work unless I close the first window (which was there before automation started).

I use Open browser to open the page. I use Output: UIBrowser to save the browser as a variable.
Later steps I use Attach browser providing the browser variable again as Input: Browser.

Am I missing something? What do I need to do more to make sure that the right browser window is used?

finding _out.xaml (7.5 KB)

itsworking fine just look at this xaml file

cheers::+1:

No worries
Welcome to uipath community
Fine
You were almost done
—let’s startva process with KILL PROCESS activity with the process name property as “iexplore” (Internet Explorer used) or as “chrome” ( if chrome browser is used ) in the property panel of kill process activity
This will close all the browser and its pages so that we can start freshly with a new browser page and to confirm with process of our browser go to task manager and click on process tab where we can find all the application with their .exe name and from that we need to take only the process name without extension like from “chrome.exe” take only “chrome” and “EXCEL.exe” take “EXCEL” alone and mention that in process name property of kill process activity

—next to make use of active browser page use a activity called get active window activity so that the active window or application will come in foreground and so we can access the elements in that page
As you are already passing browser element you are almost good
To make sure that we want to access the current page use CLICK activity as a first one along the sequence and click on the s browser page as element so that page will be there in foreground for sure

Simple isn’t it
Hope this would help
Kindly try this and let know for any queries or clarification
Cheers @HenrikX

Thank you! I’ve checked your example and it looks exactly as I’ve done (besides that I’m using Chrome). Do you always get it working even though there are existing browser windows with the same URL/Title open?

Thank you for the response. I suppose your method would be highly efficient but I need to keep most of my browser windows open so killing them would be to “efficient”. Shouldn’t the Browser-variable be sufficient for Attach browser to find the correct window?

I get all activities working as long as there are only one browser open for the specific URL/Title.

1 Like

Yah that would be more sufficient as mentioned already buddy

But I suggested to use kill process in the very beginning of the process
This make sure that browser page you open with the open browser will be the first page in the foreground so that would make sure this

Simple isn’t it
Cheers @HenrikX

The browser variable apparently only contains:

Browser { Element=UiElement { ClippingRegion=null, Selector="" } }

So how could it ever work if there is no idx parameter?