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.
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.