Have this annoying app I’m trying to automate in, and it has a habit of opening secondary windows that interfere with the automation. These windows are opening automatically, not in response to any action taken by the automation.
So at a certain point I want to close any and all chrome windows/tabs except the main window/tab which I have in a UI Element variable.
@postwick We use FindChildren activity to find the all chrome instances and close them using close window activity but in your case, you can use FindChildren Activity to find all the chrome instances, go through for each activity/each instance and validate if your current Ui element (Assuming you have it in variable) is matching with for each current instance, if it is matching then dont close it other wise close it using close window activity
I already have the original window the automation opened in a UI Element variable. I can use its unique identifier “hwnd” to close everything except that window. You can easily get title, url, hwnd, and processid (for the underlying Windows process) with .Get: