Follow new tab

I have a For Each Element sequence that clicks on an element causing a new tab to open in the browser. I need to then interact with elements in that new tab. I found a couple of relate threads but haven’t found an answer that works.
I tried adding the activity Use Application/Browser, identifying the new tab’s title but that caused a new browser window to open. At the suggestion of one of the threads, I changed that to an Attach Browser activity and that executes okay but subsequent Click activity jumps back to the original tab.
How do I get the workflow to move to that new tab?


Try to mark the “Open” propertie from your Use Application/Browser with “IfNotOpen”.

Make sure to have a Use Applcation/Browser to your new tab
If a new tab still opening, try to highlight your applcation to see if its working well.
You can check the Selector and the URL too and make sure that you don’t have any dynamic string inside it

1 Like

Stick with Use Application/Browser, but go through all the properties of it and make sure you understand what they all do. As Haniel pointed out, there is a setting that makes it open a new browser window if the one you told it to look for doesn’t exist.

I typically set it to never open and always close in these type of situations. That way the Use Application/Browser will only attach to the existing new tab, and it will close it when it’s done with it.

1 Like

I set the Use Browser to NeverOpen so now I don’t get a new Window opening but the first Click activity still jumps back to the original tab.

Hello @chuck.jowett, Check the Click activity placed in the Attach browser activity. In Attach browser activity, the bot will click the element within the tab

Is your Click activity inside the Use App/Browser that attaches to the new tab?

Yes it is. It’s actually within a Try/Catch withing the Use Browser
Here are the settings for the Click

And here is the value of the Window selector at run time

And here are the Chrome tabs

Here are the settings for the Use Browser

So, you are mainly using the “Linkedin Talent Solutions” and when you open any profile it will open in a new tab, right?

You have your Use Application/Browser set for your new tab?
Try to Insert an activity “Activate” inside your Use Application/Browser, as the first activity inside it and select your tab page. Change the “WaitForReady” propertie to “COMPLETE”. This will change the visibility for the tabs.

I think you will need to put an Activate activity every time you want to change chrome tabs, like this:

That’s not necessary. Activate is built into the Click etc activities.

That Try/Catch isn’t really the right way to do that. You should use Check App State to see if the element is there. If it doesn’t appear, click the More. Then the Click goes after the Check App State.

Anyway, I think you’re not understanding what has been explained. You have a Use App/Browser for the main page, then you click the “open profile in new window” button, then you need to have ANOTHER Use App/Browser to work within the new tab.

That’s exactly what I have.
Main.xaml (89.5 KB)

If you’re using the Chromium API on your Use Application/Browser and on your click you’re using Same as App/Browser or Chromium API, you’ll need to activate the new tab window.
You can change the input mode to simulate on your click inside the new tab.

Click Input Mode ChromiumAPI Without Activate v

Click Input Mode ChromiumAPI With Activate v

Click Input Mode Simulate v

I create a simple process (1.1 MB)

Thanks for providing a working Sample Haniel.
How did you set the Selector on the Activate activity? When I try to use the Indicate function in Studio, everything that I have tried to point to I’m told is an invalid selector.

I just used the Indicate on Screen but if you are having problems, try to paste

"<webctrl tag='HTML'/>"

inside the Selector propertie from your Activate activity, every html will have this tag

I tried that and I tried using the selector that I use for the Click activities and still the same result - jumping back to the original tab for the Click within the Try/Catch. So I tried adding a Click on an element that I know will be there always right after the Activate and it did not jump back to the original (LinkedIn Talent Solutions) tab. So I will change that Try/Catch to some other test for the element and see how that turns out.

1 Like

You can change your TryCatch for a Check AppState looking for the connect button

I changed the Try/Catch to a Check App State and it finds the button as it should and clicks on it but the next activity after the Check App State it pops back to the original tab again.

Can you provide an example of your code after the check app state and what you need to do?

Main.xaml (94.0 KB)