Bot does not recognize second tab in Chrome

Hello. I have a script in which the bot performs some activities in the first chrome tab, but then needs to hit Ctrl T to open a new tab and enter a new link and perform an activity. However, despite that my element has the correct target selector and same title, instead of clicking on the element button, it returns back to the first tab. I tried wrapping the button in the second tab with a “Use Application/Browser” activity that is run in the same instance, but it still goes to the first tab instead of clicking on the button. Don’t know what else to do. It sure might be something easy to figure out.

1 Like

Hey @private_matter

Are you using application instance or single window option in the use app please… ?

Thanks
#nK

Hey @Nithinkrishna,

I’m using application instance only.

1 Like

Hey @private_matter

You can try two things,

  1. Try with single window option

  2. Also add a new use app either inside the parent use app or separately to perform the second tab actions

Thanks
#nK

when i use application/browser activity inside or outside parent app/browser activity, it still open a new chrome session instead of tab.

1 Like

Hey @private_matter

I hope you have made the options of open and close as never in the use app activity.

Thanks
#nK

Hey @Nithinkrishna ,

I have set both options open and close to never as you mentioned in both parent and child Use Application/Browser activities and it does work. However, the procedure is a bit long and complicated for such as simple task. So basically what I did is in the parent use app/browser, I set the browser url to “*” pre-configured, then in the Do sequence, I added Ctrl T keyboard shortcut, then added a Type Into activity with the link that needs to open in the second tab, and then Enter as a keyboard shortcut. Then under it, I added the child Use Application/Browser and added the click activity for the button. That is too much complicated. In the classic apps, this wasn’t necessary. I could just simply set a title of the browser and it would automatically switch to it and perform the selected activities. Is there any shorter way to do this with the latest activity package? Obviously as of now, I’m setting the same link twice for the second tab.

Hi @private_matter ,

When you have prepared the selector for the second tab, try introducing idx attribute in the selector. When you locate the element on the screen post that go to UiExplorer, in the selector include the idx attribute and make the value 2(of the main tab screen selector).

Thanks

Hi @Shikhar_Tandon

I indicated the idx=‘2’ as you mentioned in UiExplorer but the selector becomes invalid when coming to validate. The selector attributes are correct there’s nothing wrong. The issue has to do with the Use Application/Browser window for sure and not with the selector.

Try the approach with Classic activities instead of modern activities, Currently you are using modern activity.

Thanks

Yes i know it works with classic activities but I’m getting to used to building my scripts with modern activities now.

Demo.xaml (27.5 KB)

Attached is a demo of what I’m doing. Weirdly, with the demo, the button does not click. However, in my project it does click. Take a look see if there’s a better way to do this. As you will see, the linkedin.com link is added twice which is bad. Don’t know why UiPath likes to complicate things more than they should be.

2 Likes

Will update you !

#nK

Alright sure

1 Like

That’s not the correct way to open a new tab. That’s why UiPath isn’t aware of it. The Use Application/Browser will open the tab for you - use that activity and pay careful attention to the settings for when it should open (ie always, if not already open, etc)

Hi to all.

The real solution to this issue is this. If your project consists of opening only one single tab in any browser, which does not consist of opening new tabs (Ctrl T), then in the Use Application/Browser activity, I recommend that in the Browser URL configuration, set it to “*” only. This will indicate that any element will be recognized immediately on the condition that your selectors are correct and that your browser title which is also vitally important to also be correct.

However, if you need to open a new tab, having the selectors and browser title correct is insufficient. You cannot use the same universal asterisk by itself. In order for UiPath to distinguish one tab from another, you must use another Use Application/Browser activity, but this time have it changed to the domain URL you are entering. If part of the URL is dynamic (meaning it might change sometimes), it’s recommended to replace all the parts of the URL only for the ones that change with an asterisk symbol.

Example: domainname.com/admin/xxx/yyy should be replaced with domainname.com/admin/* instead.

domainname.com never changes but parts xxx and zzz needs to be replaced with an asterisk. This will ensure that any child elements wrapped inside the Use Application/Browser activity will always work assuming that domainname.com and /admin are staying the same. Tested and confirmed to be fully working.

IMPORTANT: Make sure to also set in the right Options for the Use Application/Browser the Open property to Never in order for the second, third, and so forth tabs not to open in another new browser session instead of new tab.

I will mark this post as the solution for others to benefit from the same problem. Like if this helped you.

Regards,
k4r1

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.