How to detect a newly opened tab?

When I click on a button, it automatically downloads a file or opens a link in a new tab. I want to detect this new tab.

In my current method, I use the TimeoutException part of the Wait for Download activity and assume that a new tab has been opened. But this method is not very healthy and can cause problems in the later parts of my automation.

How can I detect a new tab opening?

@gururaser,

Use another Use Application/Browser inside existing Use Application/Browser to handle the new tab. Do your work on that tab inside this inner scope.

Make sure you are making the selector of it dynamic.

Thanks,
Ashok :slight_smile:

Use a Parallel. One branch put a Check App State that looks for the new tab. On the other branch put the Wait for Download. Set both timeouts the same, and long enough to account for enough time for one or the other to happen. In the completion condition property of the Parallel, create a variable. After both the Check App State and Wait for Download, put an Assign to set that variable to true so the Parallel will exit when one of the branches is completed. In the “does not appear” of the Check App State is where you’d throw an exception because neither the download nor the new tab happened.

1 Like

You misunderstood me :slight_smile: I can handle new tab already but I assume that new tab opened. I want to be sure

Thanks for advice!! I will try and inform you.

but I have some questions. How can I detect new tab using Check App State? The new tab is dynamic, changes every time.

You have to find something that’s similar about it. It must have something in the url or some other properties that are the same.